---
title: "Replication File: Partisan Cueing and Preferences for Fiscal Integration in the European Union"
author: "Maurits Meijers, Björn Bremer, Theresa Kuhn, and Francesco Nicoli"
date: "April 28, 2024"
output:
  bookdown::html_document2:
    keep_tex: true
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
knitr::opts_chunk$set(message = FALSE)
knitr::opts_chunk$set(warning = FALSE)
```

This document replicates the analyses for the paper "Partisan cueing and preferences for fiscal integration in the European Union" forthcoming in West European Politics and co-authored by Maurits Meijers, Björn Bremer, Theresa Kuhn, and Francesco Nicoli.

```{r, include=FALSE}
rm(list = ls())
set.seed(1234567)

# List of packages needed
packages <- c("ggplot2", "dplyr", "broom", "interactions", "stargazer", "nnet", "ggpubr", "margins", "ggrepel", "modelsummary", "kableExtra", "estimatr", "lme4", "zoo", "tidyr")

# Function to check if packages are installed and install if needed
package_check <- function(pkg){
  if (!require(pkg, character.only = TRUE)) {
    install.packages(pkg, dependencies = TRUE)
    library(pkg, character.only = TRUE)
  }
}

# Apply function to each package
invisible(sapply(packages, package_check))

# Create directories to save figures
if (!dir.exists("figures")) {
  dir.create("figures")
}

# Create directories to save tables and figures for appendix
if (!dir.exists("appendix")) {
  dir.create("appendix")
}
```

```{r, include=FALSE}
# load the original data (as returned by the survey company, excluding variables not used)
load("replication_data_wep.RData")

## create country variable 
df$Country_Name <- ifelse(df$Country == 1, "France", 
                       ifelse(df$Country == 2, "Germany", 
                              ifelse(df$Country == 3, "Italy",
                                     ifelse(df$Country == 5, "Netherlands", "Spain"))))
df$Country_Name <- factor(df$Country_Name)

## create other control variables
df$Female <- ifelse(df$Q5 == 2, 1, 0)
df$Gender <- factor(df$Female, levels = c(0, 1), labels = c("Male", "Female"))
df$Age <- 2020-df$Q4
df$Age_sq <- df$Age^2
df$Edu <- factor(df$Education_R2, levels = c(1,2,3), labels = c("Low", "Middle", "High"))
df$Inc <- factor(df$Income, levels = c(1,2,3,4), labels = c("Low", "Middle", "High", "Refused"))

df$LRposition <- ifelse(df$Q25a >= 0 & df$Q25a <= 3, "Left", 
                       ifelse(df$Q25a >= 4 & df$Q25a <= 6, "Center", 
                              ifelse(df$Q25a >= 7 & df$Q25a <= 10, "Right", NA)))
df$LRposition <- factor(df$LRposition, levels = c("Left", "Center", "Right"))

df$Redistribution <- ifelse(df$Q24a >= 0 & df$Q24a <= 3, "Low", 
                       ifelse(df$Q24a >= 4 & df$Q24a <= 6, "Medium", 
                              ifelse(df$Q24a >= 7 & df$Q24a <= 10, "High", NA)))
df$Redistribution <- factor(df$Redistribution, levels = c("Low", "Medium", "High"))

df$Identity <- ifelse(df$Q34 == 1, "Exclusive national identity",
                      ifelse(is.na(df$Q34), NA, "No exclusive national identity")) 

df$Identity <- as.factor(df$Identity)

df$COVIDeconomic <- ifelse(df$Q50new >= 0 & df$Q50new <= 5, "Not concerned", 
                                    ifelse(df$Q50new >= 6 & df$Q50new <= 10, "Concerned", NA))
df$COVIDeconomic <- factor(df$COVIDeconomic, levels = c("Concerned", "Not concerned"))
```

```{r, include=FALSE}
## create the independent variable

# code voting behavior of party in the ep
Against <- c(2, 4, 6, 9, 11, 12, 15, 16, 17, 18, 22, 23, 24, 25, 26, 28, 31, 34, 37, 38)
For <- c(3, 5, 8, 10, 13, 14, 19, 21, 27, 29, 30, 32, 33, 35, 36, 39)
Novote <- c(1, 7, 20, 40) # combine abstain and could not vote

df$EPVote <- ifelse(df$Voting_behaviour %in% Against, "Against",
                                  ifelse(df$Voting_behaviour %in% For, "In favour",
                                                ifelse(df$Voting_behaviour %in% Novote, "No vote", NA)))

# combine information on scenario and voting behavior of party in the ep and assign NA to people who received a no-vote cue
df$Treatment <- ifelse(df$Scenario == 1, "Control",
                       ifelse(df$Scenario == 2  & df$EPVote == "Against", "In-party: Against",
                              ifelse(df$Scenario == 2 & df$EPVote == "In favour", "In-party: In favour",
                                             ifelse(df$Scenario == 3 & df$EPVote == "Against", "Out-party: Against",
                                                    ifelse(df$Scenario == 3 & df$EPVote == "In favour", "Out-party: In favour", NA)))))

df$Treatment <- factor(df$Treatment, levels = c("Control", "In-party: Against", "In-party: In favour", "Out-party: Against", "Out-party: In favour"))

## include people who received a no-vote cue as a separate category
df$Treatment_all <- ifelse(df$Scenario == 1, "Control",
                       ifelse(df$Scenario == 2  & df$EPVote == "Against", "In-party: Against",
                              ifelse(df$Scenario == 2 & df$EPVote == "In favour", "In-party: In favour",
                                     ifelse(df$Scenario == 2 & df$EPVote == "No vote", "In-party: No vote",
                                             ifelse(df$Scenario == 3 & df$EPVote == "Against", "Out-party: Against",
                                                    ifelse(df$Scenario == 3 & df$EPVote == "In favour", "Out-party: In favour",
                                                           ifelse(df$Scenario == 3 & df$EPVote == "No vote", "Out-party: No vote", NA)))))))

df$Treatment_all <- factor(df$Treatment_all, levels = c("Control", "In-party: Against", "In-party: In favour", "In-party: No vote", "Out-party: Against", "Out-party: In favour", "Out-party: No vote"))

## create the dependent variables 

# support for eurobonds (1-7)
df$EBSupport <- df$QE4

# vote choice
df$EBVote <- ifelse(df$QE3 == 1, 1, 0) # 1 = support, 0 = against + would not vote 
df$EBVote_cat <- ifelse(df$QE3 == 1, "In favour",  # Three levels: favour, Against, Would not vote 
                        ifelse(df$QE3 == 2, "Against", "Would not vote"))
df$EBVote_cat <- factor(df$EBVote_cat, levels = c("Against", "In favour", "Would not vote"))

df$EBVote_cat_rec1 <- ifelse(df$EBVote_cat=="Against", "Against", ifelse(df$EBVote_cat=="In favour", "In favour", NA))
df$EBVote_cat_rec2 <- ifelse(df$EBVote_cat=="Against", "Against", ifelse(df$EBVote_cat=="Would not vote", "Would not vote", NA))

df$EBVote_fav <- ifelse(df$QE3 == 1, 1, # 1 = support, 0 = against
                     ifelse(df$QE3 == 2, 0, NA))

df$EBVote_no <- ifelse(df$QE3 == 3, 1, # 1 = no vote, 0 = against
                     ifelse(df$QE3 == 2, 0, NA))

# re-scale the support dv from 0 to 1
df$EBSupport_rec <- df$EBSupport/7
```

# Main paper
```{r new-operationalization, include=FALSE, echo=FALSE, warning=FALSE}
df$inparty_vote <- ifelse(df$QE1 %in% Against, "Against",
                                  ifelse(df$QE1 %in% For, "In favour",
                                                ifelse(df$QE1 %in% Novote, "No vote", NA)))
df$outparty_vote <- ifelse(df$QE2 %in% Against, "Against",
                                  ifelse(df$QE2 %in% For, "In favour",
                                                ifelse(df$QE2 %in% Novote, "No vote", NA)))
df$EUdecisions <- ifelse(df$Q28 == 1, "Nationalists",
                          ifelse(df$Q28 == 2 | df$Q28 == 3,"Supranationalists", NA))
df$Congruence_rec <- ifelse(df$Scenario == 1, "Control",
                        ifelse(df$EBVote_detail == df$EPVote & df$Scenario == 2, "In-party: Accept", 
                               ifelse(df$EBVote_detail != df$EPVote & df$Scenario == 2, "In-party: Reject",
                                      ifelse(df$EBVote_detail == df$EPVote & df$Scenario == 3, "Out-party: Accept", 
                                             ifelse(df$EBVote_detail != df$EPVote & df$Scenario == 3, "Out-party: Reject", NA)))))

df$Congruence_rec <- factor(df$Congruence_rec, levels = c("Control", "In-party: Accept", "In-party: Reject", "Out-party: Accept","Out-party: Reject"))

df_treatment1 <- df[which(df$Treatment=="Control" & df$inparty_vote=="In favour" | df$Treatment=="In-party: In favour"),]
df_treatment2 <- df[which(df$Treatment=="Control" & df$inparty_vote=="Against" | df$Treatment=="In-party: Against"),]
df_treatment3 <- df[which(df$Treatment=="Control" & df$outparty_vote=="In favour" | df$Treatment=="Out-party: In favour"),]
df_treatment4 <- df[which(df$Treatment=="Control" & df$outparty_vote=="Against" | df$Treatment=="Out-party: Against"),]
df_treatment5 <- df[which(df$Treatment=="Control" & df$inparty_vote=="No vote" | df$Treatment_all=="In-party: No vote"),]
df_treatment6 <- df[which(df$Treatment=="Control" & df$outparty_vote=="No vote" | df$Treatment_all=="Out-party: No vote"),]

df_treatment1$Treatment <- factor(df_treatment1$Treatment, levels = c("Control", "In-party: In favour"))
df_treatment2$Treatment <- factor(df_treatment2$Treatment, levels = c("Control", "In-party: Against"))
df_treatment3$Treatment <- factor(df_treatment3$Treatment, levels = c("Control", "Out-party: In favour"))
df_treatment4$Treatment <- factor(df_treatment4$Treatment, levels = c("Control", "Out-party: Against"))
df_treatment5$Treatment <- factor(df_treatment5$Treatment, levels = c("Control", "In-party: No vote"))
df_treatment5$Treatment <- factor(df_treatment5$Treatment, levels = c("Control", "Out-party: No vote"))
```

## Figure 1: Voting behavior of parties on the amendment by EU position
```{r, echo=FALSE, warning=FALSE, message=FALSE}
ches <- read.csv2("party_positions.csv",fileEncoding = "ISO-8859-1")
ches$Country <- ches$country
ches$country <- NULL
ches$euposition <- as.numeric(ches$euposition)
ches$lrecon <- as.numeric(ches$lrecon)
ches$fiscal_union <- as.numeric(ches$fiscal_union)

ches$cue_rec <- ifelse(ches$cue=="did not vote on this.", "Abstained", ifelse(ches$cue=="has voted against this.", "Against", ifelse(ches$cue=="has voted in favour of this.", "In favour", NA)))

## make it a one-dimensional graph

ches_vote <- filter(ches, abbre != "DLF" & abbre != "SP")

ches_vote$cue_rec <- ifelse(ches_vote$cue_rec=="In favour", "In favour", ches_vote$cue_rec)

ches_vote$cue_rec <- ordered(ches_vote$cue_rec, levels = c("In favour", "Against", "Abstained"))

figure1 <- ggplot(ches_vote, aes(x=euposition, y=0)) + 
  geom_point(aes(col=cue_rec, shape = cue_rec)) +
  facet_wrap(~ Country, ncol = 1) + 
  theme_bw() +
      ylab("") + xlab("Position on European integration (0-10)") + 
      scale_y_continuous(name = NULL, breaks = NULL) + 
      scale_x_continuous(breaks = c(1, 2, 3, 4, 5, 6, 7, 8), labels = c(1, 2, 3, 4, 5, 6, 7, 8)) + 
      scale_shape_discrete(name = "EP Vote") +
      scale_color_manual(name = "EP Vote", values = c("In favour" = "#2dc937", "Against" = "#cc3232", "Abstained" = "grey")) + 
       geom_text_repel(aes(label=abbre)) + 
      theme(legend.position="bottom")
figure1

ggsave(width = 18, height = 20, units = c("cm"), file ="figures/figure1.pdf", dpi=300)
ggsave(width = 18, height = 20, units = c("cm"), file ="figures/figure1.eps", dpi=300)
```

## Figure 2: Support for Eurobonds in five European countries, pooled
```{r, echo=FALSE, warning=FALSE, message=FALSE}
figure2a <- ggplot(df[which (df$Treatment=="Control"),], aes(EBSupport)) +  
  scale_x_continuous("Support for Eurobonds",breaks=c(1,2,3,4,5,6,7)) +
   geom_bar(aes(y = (..count..)/sum(..count..))) + 
   ylab("Share") +
   theme_bw() +  
  ggtitle("Support") + 
  theme(plot.title = element_text(face = "bold"))      

figure2b <- ggplot(df[which (df$Treatment=="Control"),], aes(EBVote_cat)) +  
  geom_bar(aes(y = (..count..)/sum(..count..))) + 
  geom_text(aes(y = (..count..)/sum(..count..), 
                label = scales::percent((..count..)/sum(..count..), accuracy = 0.1)),
            stat = "count", 
            vjust = -0.5,   
            size = 3.5) +   
  scale_y_continuous(labels = scales::percent) +
  ylab("Share") +
  xlab("Vote choice") + 
  theme_bw() +
  ggtitle("Vote Choice") + 
  theme(plot.title = element_text(face = "bold")) 

figure2 <- ggarrange(figure2a, figure2b, labels = c("A", "B"))
figure2
ggsave(figure2, width = 21, height = 12, units = c("cm"), file ="figures/figure2.pdf", dpi=300)
ggsave(figure2, width = 21, height = 12, units = c("cm"), file ="figures/figure2.eps", dpi=300)
```

## Figure 3: Average treatment effects of informing respondents about the positions of different types of parties on eurobonds
```{r, echo=FALSE, warning=FALSE, message=FALSE}
## calculate the ates on support and vote choice
m1a <- lm(EBSupport_rec ~ Treatment, data=df_treatment1)
m1b <- lm(EBSupport_rec ~ Treatment+ Country_Name, data=df_treatment1)
m1c <- lm(EBSupport_rec ~ Treatment+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment1)
m2a <- lm(EBSupport_rec ~ Treatment, data=df_treatment2)
m2b <- lm(EBSupport_rec ~ Treatment+ Country_Name, data=df_treatment2)
m2c <- lm(EBSupport_rec ~ Treatment+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment2)
m3a <- lm(EBSupport_rec ~ Treatment, data=df_treatment3)
m3b <- lm(EBSupport_rec ~ Treatment+ Country_Name, data=df_treatment3)
m3c <- lm(EBSupport_rec ~ Treatment+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment3)
m4a <- lm(EBSupport_rec ~ Treatment, data=df_treatment4)
m4b <- lm(EBSupport_rec ~ Treatment+ Country_Name, data=df_treatment4)
m4c <- lm(EBSupport_rec ~ Treatment+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment4)

m1a_df <- broom::tidy(m1a)
m1a_df$Model <- "No covariates"
m1a_df <- m1a_df[which(m1a_df$term=="TreatmentIn-party: In favour"),]
m1b_df <- broom::tidy(m1b)
m1b_df$Model <- "Country FE"
m1b_df <- m1b_df[which(m1b_df$term=="TreatmentIn-party: In favour"),]
m1c_df <- broom::tidy(m1c)
m1c_df$Model <- "Covariates + country FE"
m1c_df <- m1c_df[which(m1c_df$term=="TreatmentIn-party: In favour"),]
m2a_df <- broom::tidy(m2a)
m2a_df$Model <- "No covariates"
m2a_df <- m2a_df[which(m2a_df$term=="TreatmentIn-party: Against"),]
m2b_df <- broom::tidy(m2b)
m2b_df$Model <- "Country FE"
m2b_df <- m2b_df[which(m2b_df$term=="TreatmentIn-party: Against"),]
m2c_df <- broom::tidy(m2c)
m2c_df$Model <- "Covariates + country FE"
m2c_df <- m2c_df[which(m2c_df$term=="TreatmentIn-party: Against"),]
m3a_df <- broom::tidy(m3a)
m3a_df$Model <- "No covariates"
m3a_df <- m3a_df[which(m3a_df$term=="TreatmentOut-party: In favour"),]
m3b_df <- broom::tidy(m3b)
m3b_df$Model <- "Country FE"
m3b_df <- m3b_df[which(m3b_df$term=="TreatmentOut-party: In favour"),]
m3c_df <- broom::tidy(m3c)
m3c_df$Model <- "Covariates + country FE"
m3c_df <- m3c_df[which(m3c_df$term=="TreatmentOut-party: In favour"),]
m4a_df <- broom::tidy(m4a)
m4a_df$Model <- "No covariates"
m4a_df <- m4a_df[which(m4a_df$term=="TreatmentOut-party: Against"),]
m4b_df <- broom::tidy(m4b)
m4b_df$Model <- "Country FE"
m4b_df <- m4b_df[which(m4b_df$term=="TreatmentOut-party: Against"),]
m4c_df <- broom::tidy(m4c)
m4c_df$Model <- "Covariates + country FE"
m4c_df <- m4c_df[which(m4c_df$term=="TreatmentOut-party: Against"),]
support_df <- rbind(m1a_df, m1b_df, m1c_df, m2a_df, m2b_df, m2c_df, m3a_df, m3b_df, m3c_df, m4a_df, m4b_df, m4c_df)
support_df$upper95 <- support_df$estimate + (support_df$std.error*1.96)
support_df$lower95 <- support_df$estimate - (support_df$std.error*1.96)
support_df$Treatment <- ifelse(support_df$term=="TreatmentIn-party: In favour", "In-party: In favour", ifelse(support_df$term=="TreatmentIn-party: Against", "In-party: Against", ifelse(support_df$term=="TreatmentOut-party: In favour", "Out-party: In favour", ifelse(support_df$term=="TreatmentOut-party: Against", "Out-party: Against", NA))))
support_df$Treatment <- factor(support_df$Treatment, levels = c("Out-party: In favour", "Out-party: Against", "In-party: Against", "In-party: In favour"))
support_df$Model <- factor(support_df$Model, levels = c("Covariates + country FE", "Country FE", "No covariates"))

figure3a <- ggplot(support_df, aes(colour = Model)) + 
  geom_errorbar(aes(y = Treatment, xmin=lower95, xmax=upper95), width=0, position=position_dodge(width=0.5)) + 
  geom_point(aes(y = Treatment, x=estimate, shape = Model), position = position_dodge(width=0.5), size=2) +
  theme_bw() + 
  scale_x_continuous(breaks=c(-0.4,-0.2,0,0.2,0.4), labels = c("-0.4", "-0.2", "0", "0.2", "0.4")) +
  geom_vline(xintercept=0, color="grey", linetype = "dashed") + 
      xlab("Average treatment effect") +
  ggtitle("Support") + 
  theme(plot.title = element_text(face = "bold")) +
  xlim(-0.2, 0.2) +
      scale_color_grey(name = "Model", breaks = c("No covariates", "Country FE", "Covariates + country FE"), labels = c("No covariates", "Country FE", "Covariates + country FE"), start = 0.7, end = 0, aesthetics = "colour") +  
      scale_fill_grey(name = "Model",  breaks = c("No covariates", "Country FE", "Covariates + country FE"), labels = c("No covariates", "Country FE", "Covariates + country FE"), start = 0.7, end = 0, aesthetics = "colour") +
      scale_shape_discrete(name = "Model",  breaks = c("No covariates", "Country FE", "Covariates + country FE"), labels = c("No covariates", "Country FE", "Covariates + country FE"))

m5a <- lm(EBVote ~ Treatment, data=df_treatment1)
m5b <- lm(EBVote ~ Treatment+ Country_Name, data=df_treatment1)
m5c <- lm(EBVote ~ Treatment+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment1)
m6a <- lm(EBVote ~ Treatment, data=df_treatment2)
m6b <- lm(EBVote ~ Treatment+ Country_Name, data=df_treatment2)
m6c <- lm(EBVote ~ Treatment+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment2)
m7a <- lm(EBVote ~ Treatment, data=df_treatment3)
m7b <- lm(EBVote ~ Treatment+ Country_Name, data=df_treatment3)
m7c <- lm(EBVote ~ Treatment+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment3)
m8a <- lm(EBVote ~ Treatment, data=df_treatment4)
m8b <- lm(EBVote ~ Treatment+ Country_Name, data=df_treatment4)
m8c <- lm(EBVote ~ Treatment+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment4)

m5a_df <- broom::tidy(m5a)
m5a_df$Model <- "No covariates"
m5a_df <- m5a_df[which(m5a_df$term=="TreatmentIn-party: In favour"),]
m5b_df <- broom::tidy(m5b)
m5b_df$Model <- "Country FE"
m5b_df <- m5b_df[which(m5b_df$term=="TreatmentIn-party: In favour"),]
m5c_df <- broom::tidy(m5c)
m5c_df$Model <- "Covariates + country FE"
m5c_df <- m5c_df[which(m5c_df$term=="TreatmentIn-party: In favour"),]
m6a_df <- broom::tidy(m6a)
m6a_df$Model <- "No covariates"
m6a_df <- m6a_df[which(m6a_df$term=="TreatmentIn-party: Against"),]
m6b_df <- broom::tidy(m6b)
m6b_df$Model <- "Country FE"
m6b_df <- m6b_df[which(m6b_df$term=="TreatmentIn-party: Against"),]
m6c_df <- broom::tidy(m6c)
m6c_df$Model <- "Covariates + country FE"
m6c_df <- m6c_df[which(m6c_df$term=="TreatmentIn-party: Against"),]
m7a_df <- broom::tidy(m7a)
m7a_df$Model <- "No covariates"
m7a_df <- m7a_df[which(m7a_df$term=="TreatmentOut-party: In favour"),]
m7b_df <- broom::tidy(m7b)
m7b_df$Model <- "Country FE"
m7b_df <- m7b_df[which(m7b_df$term=="TreatmentOut-party: In favour"),]
m7c_df <- broom::tidy(m7c)
m7c_df$Model <- "Covariates + country FE"
m7c_df <- m7c_df[which(m7c_df$term=="TreatmentOut-party: In favour"),]
m8a_df <- broom::tidy(m8a)
m8a_df$Model <- "No covariates"
m8a_df <- m8a_df[which(m8a_df$term=="TreatmentOut-party: Against"),]
m8b_df <- broom::tidy(m8b)
m8b_df$Model <- "Country FE"
m8b_df <- m8b_df[which(m8b_df$term=="TreatmentOut-party: Against"),]
m8c_df <- broom::tidy(m8c)
m8c_df$Model <- "Covariates + country FE"
m8c_df <- m8c_df[which(m8c_df$term=="TreatmentOut-party: Against"),]
vote_df <- rbind(m5a_df, m5b_df, m5c_df, m6a_df, m6b_df, m6c_df, m7a_df, m7b_df, m7c_df, m8a_df, m8b_df, m8c_df)
#rm(m5a_df, m5b_df, m5c_df, m6a_df, m6b_df, m6c_df, m7a_df, m7b_df, m7c_df, m8a_df, m8b_df, m8c_df)
vote_df$upper95 <- vote_df$estimate + (vote_df$std.error*1.96)
vote_df$lower95 <- vote_df$estimate - (vote_df$std.error*1.96)
vote_df$Treatment <- ifelse(vote_df$term=="TreatmentIn-party: In favour", "In-party: In favour", ifelse(vote_df$term=="TreatmentIn-party: Against", "In-party: Against", ifelse(vote_df$term=="TreatmentOut-party: In favour", "Out-party: In favour", ifelse(vote_df$term=="TreatmentOut-party: Against", "Out-party: Against", NA))))
vote_df$Treatment <- factor(vote_df$Treatment, levels = c("Out-party: In favour", "Out-party: Against", "In-party: Against", "In-party: In favour"))

vote_df$Model <- factor(vote_df$Model, levels = c("Covariates + country FE", "Country FE", "No covariates"))

figure3b <- ggplot(vote_df, aes(colour = Model)) + 
  geom_errorbar(aes(y = Treatment, xmin=lower95, xmax=upper95), width=0, position=position_dodge(width=0.5)) + 
  geom_point(aes(y = Treatment, x=estimate, shape = Model), position = position_dodge(width=0.5), size=2) +
  theme_bw() + 
  scale_x_continuous(breaks=c(-0.4,-0.2,0,0.2,0.4), labels = c("-0.4", "-0.2", "0", "0.2", "0.4")) +
  geom_vline(xintercept=0, color="grey", linetype = "dashed") + 
      xlab("Average treatment effect") +
  ggtitle("Vote Choice") + 
  theme(plot.title = element_text(face = "bold")) +
  xlim(-0.2, 0.2) + 
      scale_color_grey(name = "Model", breaks = c("No covariates", "Country FE", "Covariates + country FE"), labels = c("No covariates", "Country FE", "Covariates + country FE"), start = 0.7, end = 0, aesthetics = "colour") +  
      scale_fill_grey(name = "Model",  breaks = c("No covariates", "Country FE", "Covariates + country FE"), labels = c("No covariates", "Country FE", "Covariates + country FE"), start = 0.7, end = 0, aesthetics = "colour") +
      scale_shape_discrete(name = "Model",  breaks = c("No covariates", "Country FE", "Covariates + country FE"), labels = c("No covariates", "Country FE", "Covariates + country FE"))

#create a combined plot for support and vote and save it
figure3 <- ggarrange(figure3a, figure3b, common.legend = TRUE, legend = "bottom", labels = c("A", "B"))
figure3
ggsave(figure3, width = 21, height = 12, units = c("cm"), file ="figures/figure3.pdf", dpi=300)
ggsave(figure3, width = 21, height = 12, units = c("cm"), file ="figures/figure3.eps", dpi=300)
```

## Figure 4: Party cueing effects on support for Eurobonds by country
```{r}
# calculate ates for support and vote by country
m1 <- lm(EBSupport_rec ~ Treatment*Country_Name, data=df_treatment1)
m2 <- lm(EBVote ~ Treatment*Country_Name, data=df_treatment1)
m3 <- lm(EBSupport_rec ~ Treatment*Country_Name, data=df_treatment2)
m4 <- lm(EBVote ~ Treatment*Country_Name, data=df_treatment2)
m5 <- lm(EBSupport_rec ~ Treatment*Country_Name, data=df_treatment3)
m6 <- lm(EBVote ~ Treatment*Country_Name, data=df_treatment3)
m7 <- lm(EBSupport_rec ~ Treatment*Country_Name, data=df_treatment4)
m8 <- lm(EBVote ~ Treatment*Country_Name, data=df_treatment4)

ma1 <- margins(m1, variables = "Treatment", at = list(Country_Name = c("France", "Germany", "Italy", "Netherlands", "Spain" )))
ame_country1 <- as.data.frame(summary(ma1))
ame_country1$Treatment <- ame_country1$factor
ame_country1$upper95 <- ame_country1$AME + (ame_country1$SE*1.96)
ame_country1$lower95 <- ame_country1$AME - (ame_country1$SE*1.96)
ame_country1$Model <- "Support"

ma2 <- margins(m2, variables = "Treatment", at = list(Country_Name = c("France", "Germany", "Italy", "Netherlands", "Spain" )))
ame_country2 <- as.data.frame(summary(ma2))
ame_country2$Treatment <- ame_country2$factor
ame_country2$upper95 <- ame_country2$AME + (ame_country2$SE*1.96)
ame_country2$lower95 <- ame_country2$AME - (ame_country2$SE*1.96)
ame_country2$Model <- "Vote choice"

ma3 <- margins(m3, variables = "Treatment", at = list(Country_Name = c("France", "Germany", "Italy", "Netherlands", "Spain" )))
ame_country3 <- as.data.frame(summary(ma3))
ame_country3$Treatment <- ame_country3$factor
ame_country3$upper95 <- ame_country3$AME + (ame_country3$SE*1.96)
ame_country3$lower95 <- ame_country3$AME - (ame_country3$SE*1.96)
ame_country3$Model <- "Support"

ma4 <- margins(m4, variables = "Treatment", at = list(Country_Name = c("France", "Germany", "Italy", "Netherlands", "Spain" )))
ame_country4 <- as.data.frame(summary(ma4))
ame_country4$Treatment <- ame_country4$factor
ame_country4$upper95 <- ame_country4$AME + (ame_country4$SE*1.96)
ame_country4$lower95 <- ame_country4$AME - (ame_country4$SE*1.96)
ame_country4$Model <- "Vote choice"

ma5 <- margins(m5, variables = "Treatment", at = list(Country_Name = c("France", "Germany", "Italy", "Netherlands", "Spain" )))
ame_country5 <- as.data.frame(summary(ma5))
ame_country5$Treatment <- ame_country5$factor
ame_country5$upper95 <- ame_country5$AME + (ame_country5$SE*1.96)
ame_country5$lower95 <- ame_country5$AME - (ame_country5$SE*1.96)
ame_country5$Model <- "Support"

ma6 <- margins(m6, variables = "Treatment", at = list(Country_Name = c("France", "Germany", "Italy", "Netherlands", "Spain" )))
ame_country6 <- as.data.frame(summary(ma6))
ame_country6$Treatment <- ame_country6$factor
ame_country6$upper95 <- ame_country6$AME + (ame_country6$SE*1.96)
ame_country6$lower95 <- ame_country6$AME - (ame_country6$SE*1.96)
ame_country6$Model <- "Vote choice"

ma7 <- margins(m7, variables = "Treatment", at = list(Country_Name = c("France", "Germany", "Italy", "Netherlands", "Spain" )))
ame_country7 <- as.data.frame(summary(ma7))
ame_country7$Treatment <- ame_country7$factor
ame_country7$upper95 <- ame_country7$AME + (ame_country7$SE*1.96)
ame_country7$lower95 <- ame_country7$AME - (ame_country7$SE*1.96)
ame_country7$Model <- "Support"

ma8 <- margins(m8, variables = "Treatment", at = list(Country_Name = c("France", "Germany", "Italy", "Netherlands", "Spain" )))
ame_country8 <- as.data.frame(summary(ma8))
ame_country8$Treatment <- ame_country8$factor
ame_country8$upper95 <- ame_country8$AME + (ame_country8$SE*1.96)
ame_country8$lower95 <- ame_country8$AME - (ame_country8$SE*1.96)
ame_country8$Model <- "Vote choice"

ame_country <- rbind(ame_country1, ame_country2, ame_country3, ame_country4, ame_country5, ame_country6, ame_country7, ame_country8)
ame_country$Treatment[ame_country$Treatment=="TreatmentIn-party: Against"] <- "In-party: Against"
ame_country$Treatment[ame_country$Treatment=="TreatmentOut-party: Against"] <- "Out-party: Against"
ame_country$Treatment[ame_country$Treatment=="TreatmentIn-party: In favour"] <- "In-party: In favour"
ame_country$Treatment[ame_country$Treatment=="TreatmentOut-party: In favour"] <- "Out-party: In favour"

ame_country$Treatment <- factor(ame_country$Treatment, levels = c("Out-party: In favour", "Out-party: Against", "In-party: Against", "In-party: In favour"))

ame_country$Model <- factor(ame_country$Model, levels = c("Vote choice", "Support"))

# plot the ates by country
figure4 <- ggplot(ame_country, aes(colour = Model)) + 
  geom_errorbar(aes(y = Treatment, xmin=lower95, xmax=upper95), width=0, position=position_dodge(width=0.5)) + 
  geom_point(aes(y = Treatment, x=AME, shape = Model), position = position_dodge(width=0.5), size=2) +
  theme_bw() + facet_wrap(~Country_Name) +
  xlim(-0.47, 0.47) +
  scale_x_continuous(breaks=c(-0.4,-0.2,0,0.2,0.4), labels = c("-0.4", "-0.2", "0", "0.2", "0.4")) +
  geom_vline(xintercept=0, color="grey", linetype = "dashed") + 
      xlab("Average treatment effect") + 
        scale_color_grey(name = "Model", breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +  
      scale_fill_grey(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +
      scale_shape_discrete(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice")) 
figure4 
ggsave(figure4, width = 20, height = 15, units = c("cm"), file ="figures/figure4.pdf", dpi=300)
ggsave(figure4, width = 20, height = 15, units = c("cm"), file ="figures/figure4.eps", dpi=300)
```

## Figure 5: Party cueing effects on support for Eurobonds by prios
```{r}
# calculate ates for support and vote by eudecision
m1 <- lm(EBSupport_rec ~ Treatment*EUdecisions, data=df_treatment1)
m2 <- lm(EBVote ~ Treatment*EUdecisions, data=df_treatment1)
m3 <- lm(EBSupport_rec ~ Treatment*EUdecisions, data=df_treatment2)
m4 <- lm(EBVote ~ Treatment*EUdecisions, data=df_treatment2)
m5 <- lm(EBSupport_rec ~ Treatment*EUdecisions, data=df_treatment3)
m6 <- lm(EBVote ~ Treatment*EUdecisions, data=df_treatment3)
m7 <- lm(EBSupport_rec ~ Treatment*EUdecisions, data=df_treatment4)
m8 <- lm(EBVote ~ Treatment*EUdecisions, data=df_treatment4)

ma1 <- margins(m1, variables = "Treatment", at = list(EUdecisions = c("Nationalists", "Supranationalists")))
ame_eudecision1 <- as.data.frame(summary(ma1))
ame_eudecision1$Treatment <- ame_eudecision1$factor
ame_eudecision1$upper95 <- ame_eudecision1$AME + (ame_eudecision1$SE*1.96)
ame_eudecision1$lower95 <- ame_eudecision1$AME - (ame_eudecision1$SE*1.96)
ame_eudecision1$Model <- "Support"

ma2 <- margins(m2, variables = "Treatment", at = list(EUdecisions = c("Nationalists", "Supranationalists")))
ame_eudecision2 <- as.data.frame(summary(ma2))
ame_eudecision2$Treatment <- ame_eudecision2$factor
ame_eudecision2$upper95 <- ame_eudecision2$AME + (ame_eudecision2$SE*1.96)
ame_eudecision2$lower95 <- ame_eudecision2$AME - (ame_eudecision2$SE*1.96)
ame_eudecision2$Model <- "Vote choice"

ma3 <- margins(m3, variables = "Treatment", at = list(EUdecisions = c("Nationalists", "Supranationalists")))
ame_eudecision3 <- as.data.frame(summary(ma3))
ame_eudecision3$Treatment <- ame_eudecision3$factor
ame_eudecision3$upper95 <- ame_eudecision3$AME + (ame_eudecision3$SE*1.96)
ame_eudecision3$lower95 <- ame_eudecision3$AME - (ame_eudecision3$SE*1.96)
ame_eudecision3$Model <- "Support"

ma4 <- margins(m4, variables = "Treatment", at = list(EUdecisions = c("Nationalists", "Supranationalists")))
ame_eudecision4 <- as.data.frame(summary(ma4))
ame_eudecision4$Treatment <- ame_eudecision4$factor
ame_eudecision4$upper95 <- ame_eudecision4$AME + (ame_eudecision4$SE*1.96)
ame_eudecision4$lower95 <- ame_eudecision4$AME - (ame_eudecision4$SE*1.96)
ame_eudecision4$Model <- "Vote choice"

ma5 <- margins(m5, variables = "Treatment", at = list(EUdecisions = c("Nationalists", "Supranationalists")))
ame_eudecision5 <- as.data.frame(summary(ma5))
ame_eudecision5$Treatment <- ame_eudecision5$factor
ame_eudecision5$upper95 <- ame_eudecision5$AME + (ame_eudecision5$SE*1.96)
ame_eudecision5$lower95 <- ame_eudecision5$AME - (ame_eudecision5$SE*1.96)
ame_eudecision5$Model <- "Support"

ma6 <- margins(m6, variables = "Treatment", at = list(EUdecisions = c("Nationalists", "Supranationalists")))
ame_eudecision6 <- as.data.frame(summary(ma6))
ame_eudecision6$Treatment <- ame_eudecision6$factor
ame_eudecision6$upper95 <- ame_eudecision6$AME + (ame_eudecision6$SE*1.96)
ame_eudecision6$lower95 <- ame_eudecision6$AME - (ame_eudecision6$SE*1.96)
ame_eudecision6$Model <- "Vote choice"

ma7 <- margins(m7, variables = "Treatment", at = list(EUdecisions = c("Nationalists", "Supranationalists")))
ame_eudecision7 <- as.data.frame(summary(ma7))
ame_eudecision7$Treatment <- ame_eudecision7$factor
ame_eudecision7$upper95 <- ame_eudecision7$AME + (ame_eudecision7$SE*1.96)
ame_eudecision7$lower95 <- ame_eudecision7$AME - (ame_eudecision7$SE*1.96)
ame_eudecision7$Model <- "Support"

ma8 <- margins(m8, variables = "Treatment", at = list(EUdecisions = c("Nationalists", "Supranationalists")))
ame_eudecision8 <- as.data.frame(summary(ma8))
ame_eudecision8$Treatment <- ame_eudecision8$factor
ame_eudecision8$upper95 <- ame_eudecision8$AME + (ame_eudecision8$SE*1.96)
ame_eudecision8$lower95 <- ame_eudecision8$AME - (ame_eudecision8$SE*1.96)
ame_eudecision8$Model <- "Vote choice"

ame_eudecision <- rbind(ame_eudecision1, ame_eudecision2, ame_eudecision3, ame_eudecision4, ame_eudecision5, ame_eudecision6, ame_eudecision7, ame_eudecision8)
ame_eudecision$Treatment[ame_eudecision$Treatment=="TreatmentIn-party: Against"] <- "In-party: Against"
ame_eudecision$Treatment[ame_eudecision$Treatment=="TreatmentOut-party: Against"] <- "Out-party: Against"
ame_eudecision$Treatment[ame_eudecision$Treatment=="TreatmentIn-party: In favour"] <- "In-party: In favour"
ame_eudecision$Treatment[ame_eudecision$Treatment=="TreatmentOut-party: In favour"] <- "Out-party: In favour"

ame_eudecision$Treatment <- factor(ame_eudecision$Treatment, levels = c("Out-party: In favour", "Out-party: Against", "In-party: Against", "In-party: In favour"))

ame_eudecision$Model <- factor(ame_eudecision$Model, levels = c("Vote choice", "Support"))

# plot the ates by eudecision
figure5 <- ggplot(ame_eudecision, aes(colour = Model)) + 
  geom_errorbar(aes(y = Treatment, xmin=lower95, xmax=upper95), width=0, position=position_dodge(width=0.5)) + 
  geom_point(aes(y = Treatment, x=AME, shape = Model), position = position_dodge(width=0.5), size=2) +
  theme_bw() + facet_wrap(~EUdecisions) +
  xlim(-0.47, 0.47) +
  scale_x_continuous(breaks=c(-0.4,-0.2,0,0.2,0.4), labels = c("-0.4", "-0.2", "0", "0.2", "0.4")) +
  geom_vline(xintercept=0, color="grey", linetype = "dashed") + 
      xlab("Average treatment effect") +
        scale_color_grey(name = "Model", breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +  
      scale_fill_grey(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +
      scale_shape_discrete(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice")) 
figure5 
ggsave(figure5, width = 18, height = 13, units = c("cm"), file ="figures/figure5.pdf", dpi=300)
ggsave(figure5, width = 18, height = 13, units = c("cm"), file ="figures/figure5.eps", dpi=300)
```

# Appendix
## Appendix A: Further Information on Data and Method

### Figure A.1: Salience of Eurobonds by country from 2008 to 2020 according to Google Trends
```{r, echo=FALSE, warning=FALSE, message=FALSE}
trends <- read.csv("googletrends_all_countries.csv", stringsAsFactors=FALSE, sep = ";")
trends <- gather(trends, country, value, germany:netherlands, factor_key=TRUE)
trends$year <- substr(trends$time, 1,4)
trends$month <- substr(trends$time, 6,8)
trends$Date <- zoo::as.yearmon(paste(trends$year, trends$month), "%Y %m")
trends$Country <- ifelse(trends$country=="germany", "Germany", ifelse(trends$country=="france", "France", ifelse(trends$country=="spain", "Spain", ifelse(trends$country=="netherlands", "Netherlands", ifelse(trends$country=="italy", "Italy", NA)))))
trends$country <- NULL

lineplot_smooth <- ggplot(trends, aes(x = Date, y = value, colour = Country)) +
  geom_smooth(aes(linetype = Country, colour = Country, fill = Country), se=FALSE, span = 0.1) + labs(title="",
       x="Year", y="Search volume") +
  theme_bw() +
  scale_x_continuous(breaks=c(2008,2010,2012,2014,2016,2018, 2020))
lineplot_smooth
ggsave(lineplot_smooth, width = 18, height = 10, units = c("cm"), file ="appendix/figureA1.pdf")
```

### Figure A2: Salience of Eurobonds vs. SARS.Cov.2 by country from 2008 to 2020 according to Google Trends
```{r, echo=FALSE, warning=FALSE, message=FALSE}
trends_comparison <- read.csv("googletrends_all_countries_comparison.csv", stringsAsFactors=FALSE, sep = ",")
trends_comparison$year <- substr(trends_comparison$time, 1,4)
trends_comparison$month <- substr(trends_comparison$time, 6,8)
trends_comparison$Date <- zoo::as.yearmon(paste(trends_comparison$year, trends_comparison$month), "%Y %m")
trends_comparison <- trends_comparison %>% pivot_longer(c(eurobonds,SARS.CoV.2), names_to = "Word", values_to = "Value")

lineplot_smooth_comparison <- ggplot(trends_comparison, aes(x = Date, y = Value, colour = Word)) +
  geom_smooth(aes(linetype = Word, colour = Word, fill = Word), se=FALSE, span = 0.1) + labs(title="",
       x="Year", y="Search volume") +
  theme_bw() +
      facet_wrap(~ Country, ncol = 1) + 
  scale_x_continuous(breaks=c(2008,2010,2012,2014,2016,2018, 2020))
lineplot_smooth_comparison
ggsave(lineplot_smooth_comparison, width = 18, height = 20, units = c("cm"), file ="appendix/figureA2.pdf")
```

### Figure A.3: Voting behavior of parties on the amendment by left-right position
```{r, results = 'asis', echo=FALSE, warning=FALSE, message=FALSE}
gg2 <- ggplot(ches_vote, aes(x=lrecon, y=0)) + 
  geom_point(aes(col=cue_rec, shape = cue_rec)) +
  facet_wrap(~ Country, ncol = 1) + 
  theme_bw() +
      ylab("") + xlab("Position on economic left-right dimension (0-10)") + 
      scale_y_continuous(name = NULL, breaks = NULL) + 
      scale_x_continuous(breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9), labels = c(1, 2, 3, 4, 5, 6, 7, 8, 9)) +
      scale_shape_discrete(name = "EP Vote") +
      scale_color_manual(name = "EP Vote", values = c("In favour" = "#2dc937", "Against" = "#cc3232", "Abstained" = "grey")) + 
       geom_text_repel(aes(label=abbre)) + 
      theme(legend.position="bottom")
gg2
ggsave(width = 18, height = 20, units = c("cm"), file ="appendix/figureA3.pdf")
```

### Figure A.4: Voting behavior of parties on the amendment by their position on a European fiscal union
```{r, echo=FALSE, warning=FALSE, message=FALSE}
figureA4 <- ggplot(ches_vote, aes(x=fiscal_union, y=0)) + 
  geom_point(aes(col=cue_rec, shape = cue_rec)) +
  facet_wrap(~ Country, ncol = 1) + 
  theme_bw() +
      ylab("") + xlab("Position on European fiscal union (0-10)") + 
      scale_y_continuous(name = NULL, breaks = NULL) + 
      scale_x_continuous(breaks = c(1, 2, 3, 4, 5, 6, 7, 8), labels = c(1, 2, 3, 4, 5, 6, 7, 8)) + 
      scale_shape_discrete(name = "EP Vote") +
      scale_color_manual(name = "EP Vote", values = c("In favour" = "#2dc937", "Against" = "#cc3232", "Abstained" = "grey")) + 
       geom_text_repel(aes(label=abbre)) + 
      theme(legend.position="bottom")
figureA4
ggsave(width = 18, height = 20, units = c("cm"), file ="appendix/figureA4.pdf")
```

### Figure A.5: Distribution of respondents' selected in- and out-party by country
```{r}

## Germany
# Create a summary table of party support by party
inparty_summary_Germany <- df %>% 
      filter(Country_Name == "Germany") %>%
      group_by(QE1) %>%
      summarise(cnt = n()) %>%
      mutate(freq = round(cnt / sum(cnt), 3)) %>% 
       arrange(desc(freq))

inparty_summary_Germany$Preference <- "In-Party"

outparty_summary_Germany <- df %>% 
      filter(Country_Name == "Germany") %>%
      group_by(QE2) %>%
      summarise(cnt = n()) %>%
      mutate(freq = round(cnt / sum(cnt), 3)) %>% 
       arrange(desc(freq))

outparty_summary_Germany$Preference <- "Out-Party"
names(outparty_summary_Germany)[names(outparty_summary_Germany) == "QE2"] <- "QE1"

party_summary_Germany <- rbind(inparty_summary_Germany, outparty_summary_Germany)

party_summary_Germany$Party <- ifelse(party_summary_Germany$QE1==9, "CDU/CSU", 
                                        ifelse(party_summary_Germany$QE1==10, "SPD", 
                                               ifelse(party_summary_Germany$QE1==11, "AfD", 
                                                      ifelse(party_summary_Germany$QE1==12, "FDP", 
                                                             ifelse(party_summary_Germany$QE1==13, "Linke",
                                                                    ifelse(party_summary_Germany$QE1==14, "Greens", NA))))))

party_summary_Germany$Party <- factor(party_summary_Germany$Party, levels = c("CDU/CSU", "SPD", "AfD", "FDP", "Linke", "Greens"))

# Create the ggplot bar graph
figureA5_de <- ggplot(party_summary_Germany, aes(x = Party, y = freq)) +
      geom_bar(stat = "identity") +
      labs(x = "Party",
       y = "Share") +
      facet_wrap(~Preference, nrow=1) +
      theme_bw() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

## France
# Create a summary table of party support by party
inparty_summary_France <- df %>% 
      filter(Country_Name == "France") %>%
      group_by(QE1) %>%
      summarise(cnt = n()) %>%
      mutate(freq = round(cnt / sum(cnt), 3)) %>% 
       arrange(desc(freq))

inparty_summary_France$Preference <- "In-Party"

outparty_summary_France <- df %>% 
      filter(Country_Name == "France") %>%
      group_by(QE2) %>%
      summarise(cnt = n()) %>%
      mutate(freq = round(cnt / sum(cnt), 3)) %>% 
       arrange(desc(freq))

outparty_summary_France$Preference <- "Out-Party"
names(outparty_summary_France)[names(outparty_summary_France) == "QE2"] <- "QE1"

party_summary_France <- rbind(inparty_summary_France, outparty_summary_France)

party_summary_France$Party <- ifelse(party_summary_France$QE1==1, "LREM", 
                                        ifelse(party_summary_France$QE1==2, "RN", 
                                               ifelse(party_summary_France$QE1==3, "PS", 
                                                      ifelse(party_summary_France$QE1==4, "LR", 
                                                             ifelse(party_summary_France$QE1==5, "EELV",
                                                                    ifelse(party_summary_France$QE1==6, "MDM", 
                                                                           ifelse(party_summary_France$QE1==7, "DLF",
                                                                                  ifelse(party_summary_France$QE1==8, "FI",NA))))))))

party_summary_France$Party <- factor(party_summary_France$Party, levels = c("LREM", "RN", "PS", "LR", "EELV", "MDM", "DLF", "FI"))

# Create the ggplot bar graph
figureA5_fr <- ggplot(party_summary_France, aes(x = Party, y = freq)) +
      geom_bar(stat = "identity") +
      labs(x = "Party",
       y = "Share") +
      facet_wrap(~Preference, nrow=1) +
      theme_bw() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))


## Netherlands
# Create a summary table of party support by party
inparty_summary_NL <- df %>% 
      filter(Country_Name == "Netherlands") %>%
      group_by(QE1) %>%
      summarise(cnt = n()) %>%
      mutate(freq = round(cnt / sum(cnt), 3)) %>% 
       arrange(desc(freq))

inparty_summary_NL$Preference <- "In-Party"

outparty_summary_NL <- df %>% 
      filter(Country_Name == "Netherlands") %>%
      group_by(QE2) %>%
      summarise(cnt = n()) %>%
      mutate(freq = round(cnt / sum(cnt), 3)) %>% 
       arrange(desc(freq))

outparty_summary_NL$Preference <- "Out-Party"
names(outparty_summary_NL)[names(outparty_summary_NL) == "QE2"] <- "QE1"

party_summary_NL <- rbind(inparty_summary_NL, outparty_summary_NL)

party_summary_NL$Party <- ifelse(party_summary_NL$QE1==15, "VVD", 
                                        ifelse(party_summary_NL$QE1==16, "PVV", 
                                               ifelse(party_summary_NL$QE1==17, "CDA", 
                                                      ifelse(party_summary_NL$QE1==18, "D66", 
                                                             ifelse(party_summary_NL$QE1==19, "GroenLinks",
                                                                    ifelse(party_summary_NL$QE1==20, "SP", 
                                                                           ifelse(party_summary_NL$QE1==21,"PvdA",
                                                                                  ifelse(party_summary_NL$QE1==22, "CU",
                                                                                         ifelse(party_summary_NL$QE1==23, "PvdD",
                                                                                                ifelse(party_summary_NL$QE1==24, "50Plus",
                                                                                                       ifelse(party_summary_NL$QE1==25, "SGP",ifelse(party_summary_NL$QE1==26,"FvD", NA))))))))))))

party_summary_NL$Party <- factor(party_summary_NL$Party, levels = c("VVD", "PVV", "CDA", "D66", "GroenLinks", "SP", "PvdA", "CU", "PvdD","50Plus","SGP", "FvD"))

# Create the ggplot bar graph
figureA5_nl <- ggplot(party_summary_NL, aes(x = Party, y = freq)) +
      geom_bar(stat = "identity") +
      labs(x = "Party",
       y = "Share") +
      facet_wrap(~Preference, nrow=1) +
      theme_bw() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

## Spain
# Create a summary table of party support by party
inparty_summary_ES <- df %>% 
      filter(Country_Name == "Spain") %>%
      group_by(QE1) %>%
      summarise(cnt = n()) %>%
      mutate(freq = round(cnt / sum(cnt), 3)) %>% 
       arrange(desc(freq))

inparty_summary_ES$Preference <- "In-Party"

outparty_summary_ES <- df %>% 
      filter(Country_Name == "Spain") %>%
      group_by(QE2) %>%
      summarise(cnt = n()) %>%
      mutate(freq = round(cnt / sum(cnt), 3)) %>% 
       arrange(desc(freq))

outparty_summary_ES$Preference <- "Out-Party"
names(outparty_summary_ES)[names(outparty_summary_ES) == "QE2"] <- "QE1"

party_summary_ES <- rbind(inparty_summary_ES, outparty_summary_ES)

party_summary_ES$Party <- ifelse(party_summary_ES$QE1==27, "PSOE", 
                                        ifelse(party_summary_ES$QE1==28, "PP", 
                                               ifelse(party_summary_ES$QE1==29, "Podemos", 
                                                      ifelse(party_summary_ES$QE1==30, "VOX", 
                                                             ifelse(party_summary_ES$QE1==31, "Cs",
                                                                    ifelse(party_summary_ES$QE1==32, "EAJ-PNV", 
                                                                           ifelse(party_summary_ES$QE1==33,"ERC",
                                                                                  ifelse(party_summary_ES$QE1==34, "JxCat",NA))))))))

party_summary_ES$Party <- factor(party_summary_ES$Party, levels = c("PSOE", "PP", "Podemos", "VOX", "Cs", "SP", "EAJ-PNV", "ERC", "JxCat"))

# Create the ggplot bar graph
figureA5_es <- ggplot(party_summary_ES, aes(x = Party, y = freq)) +
      geom_bar(stat = "identity") +
      labs(x = "Party",
       y = "Share") +
      facet_wrap(~Preference, nrow=1) +
      theme_bw() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

## Italy
# Create a summary table of party support by party
inparty_summary_IT <- df %>% 
      filter(Country_Name == "Italy") %>%
      group_by(QE1) %>%
      summarise(cnt = n()) %>%
      mutate(freq = round(cnt / sum(cnt), 3)) %>% 
       arrange(desc(freq))

inparty_summary_IT$Preference <- "In-Party"

outparty_summary_IT <- df %>% 
      filter(Country_Name == "Italy") %>%
      group_by(QE2) %>%
      summarise(cnt = n()) %>%
      mutate(freq = round(cnt / sum(cnt), 3)) %>% 
       arrange(desc(freq))

outparty_summary_IT$Preference <- "Out-Party"
names(outparty_summary_IT)[names(outparty_summary_IT) == "QE2"] <- "QE1"

party_summary_IT <- rbind(inparty_summary_IT, outparty_summary_IT)

party_summary_IT$Party <- ifelse(party_summary_IT$QE1==35, "M5S", 
                                        ifelse(party_summary_IT$QE1==36, "PD", 
                                               ifelse(party_summary_IT$QE1==37, "Lega", 
                                                      ifelse(party_summary_IT$QE1==38, "FI", 
                                                             ifelse(party_summary_IT$QE1==39, "FdI",
                                                                    ifelse(party_summary_IT$QE1==40, "IV",NA))))))

party_summary_IT$Party <- factor(party_summary_IT$Party, levels = c("M5S", "PD", "Lega", "FI", "FdI", "IV"))

# Create the ggplot bar graph
figureA5_it <- ggplot(party_summary_IT, aes(x = Party, y = freq)) +
      geom_bar(stat = "identity") +
      labs(x = "Party",
       y = "Share") +
      facet_wrap(~Preference, nrow=1) +
      theme_bw() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

## save the figures
ggsave(figureA5_de, width = 18, height = 10, units = c("cm"), file ="appendix/figureA5_de.pdf")
ggsave(figureA5_fr, width = 18, height = 10, units = c("cm"), file ="appendix/figureA5_fr.pdf")
ggsave(figureA5_nl, width = 18, height = 10, units = c("cm"), file ="appendix/figureA5_nl.pdf")
ggsave(figureA5_es, width = 18, height = 10, units = c("cm"), file ="appendix/figureA5_es.pdf")
ggsave(figureA5_it, width = 18, height = 10, units = c("cm"), file ="appendix/figureA5_it.pdf")
```

### Figure A.6: Distribution of respondents by experimental group 
```{r}
Treatment <- c("In-party: In favour", "In-party: In favour", "In-party: Against", "In-party: Against", "Out-party: In favour", "Out-party: In favour", "Out-party: Against", "Out-party: Against")
Model <- c("Treatment group", "Control group", "Treatment group", "Control group", "Treatment group", "Control group", "Treatment group", "Control group")
Number <- c(sum(df_treatment1$Treatment=="In-party: In favour"), 
            sum(df_treatment1$Treatment=="Control"), 
            sum(df_treatment2$Treatment=="In-party: Against"), 
            sum(df_treatment2$Treatment=="Control"),
            sum(df_treatment3$Treatment=="Out-party: In favour"), 
            sum(df_treatment3$Treatment=="Control"),   
            sum(df_treatment4$Treatment=="Out-party: Against"), 
            sum(df_treatment4$Treatment=="Control"))
df_respondents <- data.frame(Treatment, Model, Number)

df_respondents$Treatment <- factor(df_respondents$Treatment, levels = c("In-party: In favour", "In-party: Against", "Out-party: Against", "Out-party: In favour"))

figureA6 <- ggplot(df_respondents, aes(fill=Model, y=Number, x=Treatment)) + 
    geom_bar(position="dodge", stat="identity") + theme_bw() + 
  ylab("Number of respondents") +
  xlab("Treatment group") + scale_color_grey() + 
  scale_fill_grey() + scale_y_continuous(breaks = c(250, 500, 750, 1000, 1250)) + 
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
figureA6
ggsave(figureA6, width = 15, height = 12, units = c("cm"), file ="appendix/figureA6.pdf")
```

### Figure A.7: Distribution of respondents by experimental group and country
```{r}
# Germany
Number_DE <- c(sum(df_treatment1[which (df_treatment1$Country_Name == "Germany"),]$Treatment=="In-party: In favour"), sum(df_treatment1[which (df_treatment1$Country_Name == "Germany"),]$Treatment=="Control"),   
            sum(df_treatment2[which (df_treatment2$Country_Name == "Germany"),]$Treatment=="In-party: Against"), sum(df_treatment2[which (df_treatment2$Country_Name == "Germany"),]$Treatment=="Control"),
            sum(df_treatment3[which (df_treatment3$Country_Name == "Germany"),]$Treatment=="Out-party: In favour"), sum(df_treatment3[which (df_treatment3$Country_Name == "Germany"),]$Treatment=="Control"),   
            sum(df_treatment4[which (df_treatment4$Country_Name == "Germany"),]$Treatment=="Out-party: Against"), sum(df_treatment4[which (df_treatment4$Country_Name == "Germany"),]$Treatment=="Control"))               
df_respondents_DE <- data.frame(Treatment, Model, Number_DE)
df_respondents_DE$Country <- "Germany"
names(df_respondents_DE)[names(df_respondents_DE) == "Number_DE"] <- "Number"

# France
Number_FR <- c(sum(df_treatment1[which (df_treatment1$Country_Name == "France"),]$Treatment=="In-party: In favour"), sum(df_treatment1[which (df_treatment1$Country_Name == "France"),]$Treatment=="Control"),   
            sum(df_treatment2[which (df_treatment2$Country_Name == "France"),]$Treatment=="In-party: Against"), sum(df_treatment2[which (df_treatment2$Country_Name == "France"),]$Treatment=="Control"),
            sum(df_treatment3[which (df_treatment3$Country_Name == "France"),]$Treatment=="Out-party: In favour"), sum(df_treatment3[which (df_treatment3$Country_Name == "France"),]$Treatment=="Control"),   
            sum(df_treatment4[which (df_treatment4$Country_Name == "France"),]$Treatment=="Out-party: Against"), sum(df_treatment4[which (df_treatment4$Country_Name == "France"),]$Treatment=="Control"))               
df_respondents_FR <- data.frame(Treatment, Model, Number_FR)
df_respondents_FR$Country <- "France"
names(df_respondents_FR)[names(df_respondents_FR) == "Number_FR"] <- "Number"

# Netherlands
Number_NL <- c(sum(df_treatment1[which (df_treatment1$Country_Name == "Netherlands"),]$Treatment=="In-party: In favour"), sum(df_treatment1[which (df_treatment1$Country_Name == "Netherlands"),]$Treatment=="Control"),   
            sum(df_treatment2[which (df_treatment2$Country_Name == "Netherlands"),]$Treatment=="In-party: Against"), sum(df_treatment2[which (df_treatment2$Country_Name == "Netherlands"),]$Treatment=="Control"),
            sum(df_treatment3[which (df_treatment3$Country_Name == "Netherlands"),]$Treatment=="Out-party: In favour"), sum(df_treatment3[which (df_treatment3$Country_Name == "Netherlands"),]$Treatment=="Control"),   
            sum(df_treatment4[which (df_treatment4$Country_Name == "Netherlands"),]$Treatment=="Out-party: Against"), sum(df_treatment4[which (df_treatment4$Country_Name == "Netherlands"),]$Treatment=="Control"))               
df_respondents_NL <- data.frame(Treatment, Model, Number_NL)
df_respondents_NL$Country <- "Netherlands"
names(df_respondents_NL)[names(df_respondents_NL) == "Number_NL"] <- "Number"

# Spain
Number_ES <- c(sum(df_treatment1[which (df_treatment1$Country_Name == "Spain"),]$Treatment=="In-party: In favour"), sum(df_treatment1[which (df_treatment1$Country_Name == "Spain"),]$Treatment=="Control"),   
            sum(df_treatment2[which (df_treatment2$Country_Name == "Spain"),]$Treatment=="In-party: Against"), sum(df_treatment2[which (df_treatment2$Country_Name == "Spain"),]$Treatment=="Control"),
            sum(df_treatment3[which (df_treatment3$Country_Name == "Spain"),]$Treatment=="Out-party: In favour"), sum(df_treatment3[which (df_treatment3$Country_Name == "Spain"),]$Treatment=="Control"),   
            sum(df_treatment4[which (df_treatment4$Country_Name == "Spain"),]$Treatment=="Out-party: Against"), sum(df_treatment4[which (df_treatment4$Country_Name == "Spain"),]$Treatment=="Control"))               
df_respondents_ES <- data.frame(Treatment, Model, Number_ES)
df_respondents_ES$Country <- "Spain"
names(df_respondents_ES)[names(df_respondents_ES) == "Number_ES"] <- "Number"

# Italy
Number_IT <- c(sum(df_treatment1[which (df_treatment1$Country_Name == "Italy"),]$Treatment=="In-party: In favour"), sum(df_treatment1[which (df_treatment1$Country_Name == "Italy"),]$Treatment=="Control"),   
            sum(df_treatment2[which (df_treatment2$Country_Name == "Italy"),]$Treatment=="In-party: Against"), sum(df_treatment2[which (df_treatment2$Country_Name == "Italy"),]$Treatment=="Control"),
            sum(df_treatment3[which (df_treatment3$Country_Name == "Italy"),]$Treatment=="Out-party: In favour"), sum(df_treatment3[which (df_treatment3$Country_Name == "Italy"),]$Treatment=="Control"),   
            sum(df_treatment4[which (df_treatment4$Country_Name == "Italy"),]$Treatment=="Out-party: Against"), sum(df_treatment4[which (df_treatment4$Country_Name == "Italy"),]$Treatment=="Control"))               
df_respondents_IT <- data.frame(Treatment, Model, Number_IT)
df_respondents_IT$Country <- "Italy"
names(df_respondents_IT)[names(df_respondents_IT) == "Number_IT"] <- "Number"

df_respondents_country <- rbind(df_respondents_DE, df_respondents_FR, df_respondents_NL, df_respondents_ES, df_respondents_IT)

df_respondents_country$Treatment <- factor(df_respondents_country$Treatment, levels = c("In-party: In favour", "In-party: Against", "Out-party: Against", "Out-party: In favour"))

figureA7 <- ggplot(df_respondents_country, aes(fill=Model, y=Number, x=Treatment)) + 
    geom_bar(position="dodge", stat="identity") + theme_bw() + 
  ylab("Number of respondents") +
  xlab("Treatment group") + scale_color_grey() + 
  scale_fill_grey() + scale_y_continuous(breaks = c(250, 500, 750, 1000, 1250)) + 
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
        facet_wrap(~Country, nrow=3) 
figureA7
ggsave(figureA7, width = 15, height = 12, units = c("cm"), file ="appendix/figureA7.pdf")
```

### Tables A.4 and A.5: Descriptive statistics of respondents by in-party/out-party treatment groups
```{r}
df_treatment1$Treatment_rel <- relevel(df_treatment1$Treatment, ref = "Control")
df_treatment2$Treatment_rel <- relevel(df_treatment2$Treatment, ref = "Control")
df_treatment3$Treatment_rel <- relevel(df_treatment3$Treatment, ref = "Control")
df_treatment4$Treatment_rel <- relevel(df_treatment4$Treatment, ref = "Control")

df_select1 <- df_treatment1 %>%
            select(Treatment_rel,
                   Gender, Age, Age_sq, Edu, Inc, EUdecisions, LRposition, Identity, COVIDeconomic)
df_select2 <- df_treatment2 %>%
            select(Treatment_rel,
                   Gender, Age, Age_sq, Edu, Inc, EUdecisions, LRposition, Identity, COVIDeconomic)
df_select3 <- df_treatment3 %>%
            select(Treatment_rel,
                   Gender, Age, Age_sq, Edu, Inc, EUdecisions, LRposition, Identity, COVIDeconomic)
df_select4 <- df_treatment4 %>%
            select(Treatment_rel,
                   Gender, Age, Age_sq, Edu, Inc, EUdecisions, LRposition, Identity, COVIDeconomic)

df_datasummary1 <- datasummary_balance(~Treatment_rel,
                    data = df_select1,  output = 'data.frame')
df_datasummary1 <- df_datasummary1 %>% rename(Variable = ` `, Subgroup= `  `) %>% select(Variable, Subgroup, `Control (N=1235) / Mean`, `Control (N=1235) / Std. Dev.`, `In-party: In favour (N=1226) / Mean`, `In-party: In favour (N=1226) / Std. Dev.`)

df_datasummary2 <- datasummary_balance(~Treatment_rel,
                    data = df_select2, output = 'data.frame')
df_datasummary2 <- df_datasummary2 %>% rename(Variable = ` `, Subgroup= `  `) %>% select(`Control (N=1068) / Mean`, `Control (N=1068) / Std. Dev.`, `In-party: Against (N=1095) / Mean`, `In-party: Against (N=1095) / Std. Dev.`)

df_datasummary3 <- datasummary_balance(~Treatment_rel,
                    data = df_select3, output = 'data.frame')
df_datasummary3 <- df_datasummary3 %>% rename(Variable = ` `, Subgroup= `  `) %>% select(`Control (N=1065) / Mean`, `Control (N=1065) / Std. Dev.`, `Out-party: In favour (N=959) / Mean`, `Out-party: In favour (N=959) / Std. Dev.`)

df_datasummary4 <- datasummary_balance(~Treatment_rel,
                    data = df_select4, output = 'data.frame')
df_datasummary4 <- df_datasummary4 %>% rename(Variable = ` `, Subgroup= `  `) %>% select(Variable, Subgroup, `Control (N=1286) / Mean`, `Control (N=1286) / Std. Dev.`, `Out-party: Against (N=1389) / Mean`, `Out-party: Against (N=1389) / Std. Dev.`)

df_datasummary5 <- cbind(df_datasummary1, df_datasummary2)
table_datasummary1 <- kableExtra::kbl(df_datasummary5, caption = "Descriptive statistics of respondents by in-party treatment groups",col.names = NULL, booktabs = T, format = 'latex') %>% kableExtra::add_header_above(c("Variable" = 1, "Subgroup"=1, "Mean" = 1, "Std. Dev." = 1, "Mean" = 1, "Std. Dev." = 1,"Mean" = 1, "Std Dev." = 1, "Mean" = 1, "Std. Dev." = 1))  %>% kableExtra::add_header_above(c(" " = 2, "Control (N=1235)" = 2, "Treatment (N=1226)" = 2, "Control (N=1068)" = 2, "Treatment (N=1095)" = 2)) %>% kableExtra::add_header_above(c(" " = 2, "In-party: In favour" = 4, "In-party: Against" = 4))
writeLines(table_datasummary1, 'appendix/tableA4.tex')

df_datasummary6 <- cbind(df_datasummary4, df_datasummary3)
table_datasummary2 <- kableExtra::kbl(df_datasummary6, caption = "Descriptive statistics of respondents by out-party treatment groups",col.names = NULL, booktabs = T, format = 'latex') %>% kableExtra::add_header_above(c("Variable" = 1, "Subgroup"=1, "Mean" = 1, "Std. Dev." = 1, "Mean" = 1, "Std. Dev." = 1,"Mean" = 1, "Std Dev." = 1, "Mean" = 1, "Std. Dev." = 1))  %>% kableExtra::add_header_above(c(" " = 2,  "Control (N=1286)" = 2, "Treatment (N=1389)" = 2, "Control (N=1065)" = 2, "Treatment (N=959)" = 2)) %>% kableExtra::add_header_above(c(" " = 2, "Out-party: In favour" = 4, "Out-party: Against" = 4))
writeLines(table_datasummary2, 'appendix/tableA5.tex')
```

## Appendix B: Additional Results
### Figure A.8: Support for Eurobonds by country
```{r}
figureA8a <- ggplot(df[which (df$Treatment=="Control"),], aes(EBSupport, group = Country_Name)) +  
  scale_x_continuous("Support for Eurobonds", breaks=c(1,2,3,4,5,6,7)) +
  geom_bar(aes(y = ..prop..), stat="count", show.legend = FALSE) + 
  #scale_y_continuous(breaks = c(0.0, 0.05, 0.1, 0.15, 0.20, 0.25, 0.30, 0.35)) + 
  facet_wrap(Country_Name ~ .) +
  ylab("Share") +
  theme_bw()      
figureA8a
ggsave(figureA8a, width = 15, height = 12, units = c("cm"), file = "appendix/figureA8a.pdf")

figureA8b <- ggplot(df[which(df$Treatment=="Control"), ], aes(EBVote_cat, group = Country_Name)) +  
  geom_bar(aes(y = ..prop..), stat = "count", show.legend = FALSE) + 
  geom_text(aes(y = ..prop..,
                label = scales::percent(..prop.., accuracy = 0.1)),
            stat = "count", 
            position = position_dodge(width = 0.9),
            vjust = -0.5,   
            size = 3) +      
  scale_y_continuous(labels = scales::percent) +
  ylab("Share") +
  xlab("Vote choice") + 
  facet_wrap(Country_Name ~ .) +
  theme_bw() + 
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
figureA8b
ggsave(figureA8b, width = 15, height = 12, units = c("cm"), file ="appendix/figureA8b.pdf")
```

### Tables: A.6 and A.7: Regression tables corresponding to Figure 3
```{r}
m1a <- lm(EBSupport_rec ~ Treatment, data=df_treatment1)
m1b <- lm(EBSupport_rec ~ Treatment+ Country_Name, data=df_treatment1)
m1c <- lm(EBSupport_rec ~ Treatment+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment1)
m2a <- lm(EBSupport_rec ~ Treatment, data=df_treatment2)
m2b <- lm(EBSupport_rec ~ Treatment+ Country_Name, data=df_treatment2)
m2c <- lm(EBSupport_rec ~ Treatment+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment2)
m3a <- lm(EBSupport_rec ~ Treatment, data=df_treatment3)
m3b <- lm(EBSupport_rec ~ Treatment+ Country_Name, data=df_treatment3)
m3c <- lm(EBSupport_rec ~ Treatment+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment3)
m4a <- lm(EBSupport_rec ~ Treatment, data=df_treatment4)
m4b <- lm(EBSupport_rec ~ Treatment+ Country_Name, data=df_treatment4)
m4c <- lm(EBSupport_rec ~ Treatment+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment4)

stargazer(m1a, m2a, m4a, m3a, m1b, m2b, m4b, m3b, m1c, m2c, m4c, m3c, type = "latex",  no.space = TRUE, out="appendix/tableA6.tex", star.cutoffs = c(0.05, 0.01, 0.001), dep.var.labels = c("Support"), covariate.labels = c("In-party: In favour", "In-party: Against", "Out-party: Against", "Out-party: In favour"), omit = c("Gender", "Age", "Age_sq", "Edu", "Inc", "Country_Name"), omit.stat = c("ser","f"), add.lines=list(c("Country-fixed effects?", "No", "No", "No", "No", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes"), c("Controls?", "No", "No", "No", "No", "No", "No", "No", "No", "Yes", "Yes", "Yes", "Yes")), column.sep.width = "-10pt", font.size = "footnotesize", table.placement = "H", title = "OLS regressions for average treatment effects of party cues on support for Eurobonds", label = "tab:main_models_support")

m5a <- lm(EBVote ~ Treatment, data=df_treatment1)
m5b <- lm(EBVote ~ Treatment+ Country_Name, data=df_treatment1)
m5c <- lm(EBVote ~ Treatment+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment1)
m6a <- lm(EBVote ~ Treatment, data=df_treatment2)
m6b <- lm(EBVote ~ Treatment+ Country_Name, data=df_treatment2)
m6c <- lm(EBVote ~ Treatment+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment2)
m7a <- lm(EBVote ~ Treatment, data=df_treatment3)
m7b <- lm(EBVote ~ Treatment+ Country_Name, data=df_treatment3)
m7c <- lm(EBVote ~ Treatment+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment3)
m8a <- lm(EBVote ~ Treatment, data=df_treatment4)
m8b <- lm(EBVote ~ Treatment+ Country_Name, data=df_treatment4)
m8c <- lm(EBVote ~ Treatment+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment4)

stargazer(m5a, m6a, m8a, m7a, m5b, m6b, m8b, m7b, m5c, m6c, m8c, m7c,  type = "latex",  no.space = TRUE, out="appendix/tableA7.tex", star.cutoffs = c(0.05, 0.01, 0.001), dep.var.labels = c("Vote"), covariate.labels = c("In-party: In favour", "In-party: Against", "Out-party: Against", "Out-party: In favour"), omit = c("Gender", "Age", "Age_sq", "Edu", "Inc", "Country_Name"), omit.stat = c("ser","f"), add.lines=list(c("Country-fixed effects?", "No", "No", "No", "No", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes"), c("Controls?", "No", "No", "No", "No", "No", "No", "No", "No", "Yes", "Yes", "Yes", "Yes")), column.sep.width = "-10pt", font.size = "footnotesize", table.placement = "H", title = "OLS regressions for average treatment effects of party cues on vote choice", label = "tab:main_models_vote")
```

### Tables A.8 and A.9: Regression tables estimating correlates 
```{r}
df$Identity <- factor(df$Identity, levels = c("No exclusive national identity", "Exclusive national identity"))

## create regression table for regression
m13 <- lm(EBSupport_rec ~ Treatment + Gender + Age + Age_sq + Edu + Inc + EUdecisions + LRposition + Identity + COVIDeconomic + Country_Name, data=df_treatment1)
m14 <- lm(EBSupport_rec ~ Treatment + Gender + Age + Age_sq + Edu + Inc + EUdecisions + LRposition + Identity + COVIDeconomic + Country_Name, data=df_treatment2)
m15 <- lm(EBSupport_rec ~ Treatment + Gender + Age + Age_sq + Edu + Inc + EUdecisions + LRposition + Identity + COVIDeconomic + Country_Name, data=df_treatment3)
m16 <- lm(EBSupport_rec ~ Treatment + Gender + Age + Age_sq + Edu + Inc + EUdecisions + LRposition + Identity + COVIDeconomic + Country_Name, data=df_treatment4)

stargazer(m13, m14, m16, m15, type = "latex", no.space = TRUE, out="appendix/tableA8.tex", star.cutoffs = c(0.05, 0.01, 0.001), dep.var.labels = c("Support"), column.sep.width = "-12pt", omit.stat = c("ser","f"), font.size = "footnotesize", table.placement = "htbp", title = "Individual-level determinants of support for Eurobonds", label = "tab:correlates_support", covariate.labels = c("In-party: In favour", "In-party: Against", "Out-party: Against", "Out-party: In favour",
"Female", "Age", "Age squared", "Education (ref.: low): Middle", "Education: High", "Income (ref.: low): Middle", "Income: High", "Income: Refused","No EU decisions", "LR position (ref.: Left): Center", "LR position: Right", "Exclusive national identity", "No COVID economic risk", "Country (ref.: France): Germany", "Country: Italy", "Country: Netherlands", "Country: Spain"))

m17 <- lm(EBVote ~ Treatment + Gender + Age + Age_sq + Edu + Inc + EUdecisions + LRposition + Identity + COVIDeconomic + Country_Name, data=df_treatment1)
m18 <- lm(EBVote ~ Treatment + Gender + Age + Age_sq + Edu + Inc + EUdecisions + LRposition + Identity + COVIDeconomic + Country_Name, data=df_treatment2)
m19 <- lm(EBVote ~ Treatment + Gender + Age + Age_sq + Edu + Inc + EUdecisions + LRposition + Identity + COVIDeconomic + Country_Name, data=df_treatment3)
m20 <- lm(EBVote ~ Treatment + Gender + Age + Age_sq + Edu + Inc + EUdecisions + LRposition + Identity + COVIDeconomic + Country_Name, data=df_treatment4)

stargazer(m17, m18, m20, m19, type = "latex", no.space = TRUE, out="appendix/TableA9.tex", star.cutoffs = c(0.05, 0.01, 0.001), dep.var.labels = c("Vote choice"), column.sep.width = "-12pt", omit.stat = c("ser","f"), font.size = "footnotesize", table.placement = "htbp", title = "Individual-level determinants of vote choice on Eurobonds", label = "tab:correlates_vote", covariate.labels = c("In-party: In favour", "In-party: Against", "Out-party: Against", "Out-party: In favour",
"Female", "Age", "Age squared", "Education (ref.: low): Middle", "Education: High", "Income (ref.: low): Middle", "Income: High", "Income: Refused","No EU decisions", "LR position (ref.: Left): Center", "LR position: Right", "Exclusive national identity", "No COVID economic risk", "Country (ref.: France): Germany", "Country: Italy", "Country: Netherlands", "Country: Spain"))
```

### Figure A.9: Predicted support for Eurobonds by country
```{r, echo=FALSE}
# include country interactions for support
m25 <- lm(EBSupport ~ Treatment*Country_Name, data=df_treatment1)
m26 <- lm(EBSupport ~ Treatment*Country_Name, data=df_treatment2)
m27 <- lm(EBSupport ~ Treatment*Country_Name, data=df_treatment3)
m28 <- lm(EBSupport ~ Treatment*Country_Name, data=df_treatment4)

prob_support_tr1 <- cat_plot(m25, pred = Treatment, modx = Country_Name, y.label = c("Support for Eurobonds"), errorbar.width = 0, pred.point.size = 1.5, line.thickness = 1, colors = c("black", "black", "black", "black", "black")) + 
      facet_wrap(~Country_Name) + theme_bw() + coord_flip() + theme(legend.position="none")
prob_support_tr1_df <- data.frame(prob_support_tr1$data)
prob_support_tr1_df$Model <- ifelse(prob_support_tr1_df$Treatment!="Control", "Treatment", "Control")
prob_support_tr1_df$Treatment <- "In-party: In favour"

prob_support_tr2 <- cat_plot(m26, pred = Treatment, modx = Country_Name, y.label = c("Support for Eurobonds"), errorbar.width = 0, pred.point.size = 1.5, line.thickness = 1, colors = c("black", "black", "black", "black", "black")) + 
      facet_wrap(~Country_Name) + theme_bw() + coord_flip() + theme(legend.position="none")
prob_support_tr2_df <- data.frame(prob_support_tr2$data)
prob_support_tr2_df$Model <- ifelse(prob_support_tr2_df$Treatment!="Control", "Treatment", "Control")
prob_support_tr2_df$Treatment <- "In-party: Against"

prob_support_tr3 <- cat_plot(m27, pred = Treatment, modx = Country_Name, y.label = c("Support for Eurobonds"), errorbar.width = 0, pred.point.size = 1.5, line.thickness = 1, colors = c("black", "black", "black", "black", "black")) + 
      facet_wrap(~Country_Name) + theme_bw() + coord_flip() + theme(legend.position="none")
prob_support_tr3_df <- data.frame(prob_support_tr3$data)
prob_support_tr3_df$Model <- ifelse(prob_support_tr3_df$Treatment!="Control", "Treatment", "Control")
prob_support_tr3_df$Treatment <- "Out-party: In favour"

prob_support_tr4 <- cat_plot(m28, pred = Treatment, modx = Country_Name, y.label = c("Support for Eurobonds"), errorbar.width = 0, pred.point.size = 1.5, line.thickness = 1, colors = c("black", "black", "black", "black", "black")) + 
      facet_wrap(~Country_Name) + theme_bw() + coord_flip() + theme(legend.position="none")
prob_support_tr4_df <- data.frame(prob_support_tr4$data)
prob_support_tr4_df$Model <- ifelse(prob_support_tr4_df$Treatment!="Control", "Treatment", "Control")
prob_support_tr4_df$Treatment <- "Out-party: Against"

prob_country_df <- rbind(prob_support_tr1_df, prob_support_tr2_df, prob_support_tr3_df, prob_support_tr4_df)
rm(prob_support_tr1_df, prob_support_tr2_df, prob_support_tr3_df, prob_support_tr4_df)

prob_country_df$Treatment <- factor(prob_country_df$Treatment, levels = c("Out-party: In favour", "Out-party: Against", "In-party: Against", "In-party: In favour"))
prob_country_df$Model <- factor(prob_country_df$Model, levels = c("Treatment", "Control"))

figureA9 <- ggplot(prob_country_df, aes(colour = Model)) + 
  geom_errorbar(aes(y = Treatment, xmin=ymin, xmax=ymax), width=0, position=position_dodge(width=0.5)) + 
  geom_point(aes(y = Treatment, x=EBSupport, shape = Model), position = position_dodge(width=0.5), size=2) +
  theme_bw() + facet_wrap(~modx_group) +
      xlab("Predicted support") +
      scale_color_grey(name = "Model", breaks = c("Control", "Treatment"), labels = c("Control", "Treatment"), start = 0.7, end = 0, aesthetics = "colour") +
      scale_fill_grey(name = "Model", breaks = c("Control", "Treatment"), labels = c("Control", "Treatment"), start = 0.7, end = 0, aesthetics = "colour") + 
      scale_shape_discrete(name = "Model", breaks = c("Control", "Treatment"), labels = c("Control", "Treatment")) 
figureA9 
ggsave(figureA9, width = 20, height = 15, units = c("cm"), file ="appendix/figureA9.pdf")
```

### Figure A.10: Predicted support for Eurobonds by EU integration priors
```{r}
# predicted support by EU decisions
m10a <- lm(EBSupport ~ Treatment*EUdecisions + Country_Name, data=df_treatment1)
m10b <- lm(EBSupport ~ Treatment*EUdecisions + Country_Name, data=df_treatment2)
m10c <- lm(EBSupport ~ Treatment*EUdecisions + Country_Name, data=df_treatment3)
m10d <- lm(EBSupport ~ Treatment*EUdecisions + Country_Name, data=df_treatment4)

prob_support_tr1 <- cat_plot(m10a, pred = Treatment, modx = EUdecisions, y.label = c("Support for Eurobonds"), errorbar.width = 0, pred.point.size = 1.5, line.thickness = 1, colors = c("black", "black", "black", "black", "black")) + 
      facet_wrap(~Country_Name) + theme_bw() + coord_flip() + theme(legend.position="none")
prob_support_tr1_df <- data.frame(prob_support_tr1$data)
prob_support_tr1_df$Model <- ifelse(prob_support_tr1_df$Treatment!="Control", "Treatment", "Control")
prob_support_tr1_df$Treatment <- "In-party: In favour"

prob_support_tr2 <- cat_plot(m10b, pred = Treatment, modx = EUdecisions, y.label = c("Support for Eurobonds"), errorbar.width = 0, pred.point.size = 1.5, line.thickness = 1, colors = c("black", "black", "black", "black", "black")) + 
      facet_wrap(~Country_Name) + theme_bw() + coord_flip() + theme(legend.position="none")
prob_support_tr2_df <- data.frame(prob_support_tr2$data)
prob_support_tr2_df$Model <- ifelse(prob_support_tr2_df$Treatment!="Control", "Treatment", "Control")
prob_support_tr2_df$Treatment <- "In-party: Against"

prob_support_tr3 <- cat_plot(m10c, pred = Treatment, modx = EUdecisions, y.label = c("Support for Eurobonds"), errorbar.width = 0, pred.point.size = 1.5, line.thickness = 1, colors = c("black", "black", "black", "black", "black")) + 
      facet_wrap(~Country_Name) + theme_bw() + coord_flip() + theme(legend.position="none")
prob_support_tr3_df <- data.frame(prob_support_tr3$data)
prob_support_tr3_df$Model <- ifelse(prob_support_tr3_df$Treatment!="Control", "Treatment", "Control")
prob_support_tr3_df$Treatment <- "Out-party: In favour"

prob_support_tr4 <- cat_plot(m10d, pred = Treatment, modx = EUdecisions, y.label = c("Support for Eurobonds"), errorbar.width = 0, pred.point.size = 1.5, line.thickness = 1, colors = c("black", "black", "black", "black", "black")) + 
      facet_wrap(~Country_Name) + theme_bw() + coord_flip() + theme(legend.position="none")
prob_support_tr4_df <- data.frame(prob_support_tr4$data)
prob_support_tr4_df$Model <- ifelse(prob_support_tr4_df$Treatment!="Control", "Treatment", "Control")
prob_support_tr4_df$Treatment <- "Out-party: Against"

prob_support_tr_df <- rbind(prob_support_tr1_df, prob_support_tr2_df, prob_support_tr3_df, prob_support_tr4_df)
rm(prob_support_tr1_df, prob_support_tr2_df, prob_support_tr3_df, prob_support_tr4_df)

prob_support_tr_df$Treatment <- factor(prob_support_tr_df$Treatment, levels = c("Out-party: In favour", "Out-party: Against", "In-party: Against", "In-party: In favour"))
prob_support_tr_df$Model <- factor(prob_support_tr_df$Model, levels = c("Treatment", "Control"))

figureA10 <- ggplot(prob_support_tr_df, aes(colour = Model)) + 
  geom_errorbar(aes(y = Treatment, xmin=ymin, xmax=ymax), width=0, position=position_dodge(width=0.5)) + 
  geom_point(aes(y = Treatment, x=EBSupport, shape = Model), position = position_dodge(width=0.5), size=2) +
  theme_bw() + facet_wrap(~modx_group) + 
      xlab("Predicted support") +
      scale_color_grey(name = "Model", breaks = c("Control", "Treatment"), labels = c("Control", "Treatment"), start = 0.7, end = 0, aesthetics = "colour") +
      scale_fill_grey(name = "Model", breaks = c("Control", "Treatment"), labels = c("Control", "Treatment"), start = 0.7, end = 0, aesthetics = "colour") + 
      scale_shape_discrete(name = "Model", breaks = c("Control", "Treatment"), labels = c("Control", "Treatment")) 
figureA10 
ggsave(figureA10, width = 20, height = 15, units = c("cm"), file ="appendix/figureA10.pdf")
```

## C Robustness Tests
### Figure A.11: Average treatment effects of partxy cues on support for Eurobonds by attention
```{r, results = 'asis', message=F, echo=FALSE}
df$AttentionCheck_rec <- ifelse(df$AttentionCheck==1, "Passed", ifelse(df$AttentionCheck==0, "Failed", NA))
df_treatment1 <- df[which(df$Treatment=="Control" & df$inparty_vote=="In favour" |df$Treatment=="In-party: In favour"),]
df_treatment2 <- df[which(df$Treatment=="Control" & df$inparty_vote=="Against" |df$Treatment=="In-party: Against"),]
df_treatment3 <- df[which(df$Treatment=="Control" & df$outparty_vote=="In favour" |df$Treatment=="Out-party: In favour"),]
df_treatment4 <- df[which(df$Treatment=="Control" & df$outparty_vote=="Against" |df$Treatment=="Out-party: Against"),]

df_treatment1$Treatment <- factor(df_treatment1$Treatment, levels = c("Control", "In-party: In favour"))
df_treatment2$Treatment <- factor(df_treatment2$Treatment, levels = c("Control", "In-party: Against"))
df_treatment3$Treatment <- factor(df_treatment3$Treatment, levels = c("Control", "Out-party: In favour"))
df_treatment4$Treatment <- factor(df_treatment4$Treatment, levels = c("Control", "Out-party: Against"))

# calculate ates for support and vote by attention
m1 <- lm(EBSupport_rec ~ Treatment*AttentionCheck_rec, data=df_treatment1)
m2 <- lm(EBVote ~ Treatment*AttentionCheck_rec, data=df_treatment1)
m3 <- lm(EBSupport_rec ~ Treatment*AttentionCheck_rec, data=df_treatment2)
m4 <- lm(EBVote ~ Treatment*AttentionCheck_rec, data=df_treatment2)
m5 <- lm(EBSupport_rec ~ Treatment*AttentionCheck_rec, data=df_treatment3)
m6 <- lm(EBVote ~ Treatment*AttentionCheck_rec, data=df_treatment3)
m7 <- lm(EBSupport_rec ~ Treatment*AttentionCheck_rec, data=df_treatment4)
m8 <- lm(EBVote ~ Treatment*AttentionCheck_rec, data=df_treatment4)

ma1 <- margins(m1, variables = "Treatment", at = list(AttentionCheck_rec = c("Passed", "Failed" )))
ame_attention1 <- as.data.frame(summary(ma1))
ame_attention1$Treatment <- ame_attention1$factor
ame_attention1$upper95 <- ame_attention1$AME + (ame_attention1$SE*1.96)
ame_attention1$lower95 <- ame_attention1$AME - (ame_attention1$SE*1.96)
ame_attention1$Model <- "Support"

ma2 <- margins(m2, variables = "Treatment", at = list(AttentionCheck_rec = c("Passed", "Failed" )))
ame_attention2 <- as.data.frame(summary(ma2))
ame_attention2$Treatment <- ame_attention2$factor
ame_attention2$upper95 <- ame_attention2$AME + (ame_attention2$SE*1.96)
ame_attention2$lower95 <- ame_attention2$AME - (ame_attention2$SE*1.96)
ame_attention2$Model <- "Vote choice"

ma3 <- margins(m3, variables = "Treatment", at = list(AttentionCheck_rec = c("Passed", "Failed" )))
ame_attention3 <- as.data.frame(summary(ma3))
ame_attention3$Treatment <- ame_attention3$factor
ame_attention3$upper95 <- ame_attention3$AME + (ame_attention3$SE*1.96)
ame_attention3$lower95 <- ame_attention3$AME - (ame_attention3$SE*1.96)
ame_attention3$Model <- "Support"

ma4 <- margins(m4, variables = "Treatment", at = list(AttentionCheck_rec = c("Passed", "Failed" )))
ame_attention4 <- as.data.frame(summary(ma4))
ame_attention4$Treatment <- ame_attention4$factor
ame_attention4$upper95 <- ame_attention4$AME + (ame_attention4$SE*1.96)
ame_attention4$lower95 <- ame_attention4$AME - (ame_attention4$SE*1.96)
ame_attention4$Model <- "Vote choice"

ma5 <- margins(m5, variables = "Treatment", at = list(AttentionCheck_rec = c("Passed", "Failed" )))
ame_attention5 <- as.data.frame(summary(ma5))
ame_attention5$Treatment <- ame_attention5$factor
ame_attention5$upper95 <- ame_attention5$AME + (ame_attention5$SE*1.96)
ame_attention5$lower95 <- ame_attention5$AME - (ame_attention5$SE*1.96)
ame_attention5$Model <- "Support"

ma6 <- margins(m6, variables = "Treatment", at = list(AttentionCheck_rec = c("Passed", "Failed" )))
ame_attention6 <- as.data.frame(summary(ma6))
ame_attention6$Treatment <- ame_attention6$factor
ame_attention6$upper95 <- ame_attention6$AME + (ame_attention6$SE*1.96)
ame_attention6$lower95 <- ame_attention6$AME - (ame_attention6$SE*1.96)
ame_attention6$Model <- "Vote choice"

ma7 <- margins(m7, variables = "Treatment", at = list(AttentionCheck_rec = c("Passed", "Failed" )))
ame_attention7 <- as.data.frame(summary(ma7))
ame_attention7$Treatment <- ame_attention7$factor
ame_attention7$upper95 <- ame_attention7$AME + (ame_attention7$SE*1.96)
ame_attention7$lower95 <- ame_attention7$AME - (ame_attention7$SE*1.96)
ame_attention7$Model <- "Support"

ma8 <- margins(m8, variables = "Treatment", at = list(AttentionCheck_rec = c("Passed", "Failed" )))
ame_attention8 <- as.data.frame(summary(ma8))
ame_attention8$Treatment <- ame_attention8$factor
ame_attention8$upper95 <- ame_attention8$AME + (ame_attention8$SE*1.96)
ame_attention8$lower95 <- ame_attention8$AME - (ame_attention8$SE*1.96)
ame_attention8$Model <- "Vote choice"

ame_attention <- rbind(ame_attention1, ame_attention2, ame_attention3, ame_attention4, ame_attention5, ame_attention6, ame_attention7, ame_attention8)
ame_attention$Treatment[ame_attention$Treatment=="TreatmentIn-party: Against"] <- "In-party: Against"
ame_attention$Treatment[ame_attention$Treatment=="TreatmentOut-party: Against"] <- "Out-party: Against"
ame_attention$Treatment[ame_attention$Treatment=="TreatmentIn-party: In favour"] <- "In-party: In favour"
ame_attention$Treatment[ame_attention$Treatment=="TreatmentOut-party: In favour"] <- "Out-party: In favour"

ame_attention$Treatment <- factor(ame_attention$Treatment, levels = c("Out-party: In favour", "Out-party: Against", "In-party: Against", "In-party: In favour"))

ame_attention$Model <- factor(ame_attention$Model, levels = c("Vote choice", "Support"))

# plot the ates by attention
figureA11 <- ggplot(ame_attention, aes(colour = Model)) + 
  geom_errorbar(aes(y = Treatment, xmin=lower95, xmax=upper95), width=0, position=position_dodge(width=0.5)) + 
  geom_point(aes(y = Treatment, x=AME, shape = Model), position = position_dodge(width=0.5), size=2) +
  theme_bw() + facet_wrap(~AttentionCheck_rec) + 
  scale_x_continuous(limits= c(-0.27, 0.27), breaks=c(-0.2,0, 0.2), labels = c("-0.2",  "0", "0.2")) +
  geom_vline(xintercept=0, color="grey", linetype = "dashed") + 
      xlab("Average treatment effect") + 
        scale_color_grey(name = "Model", breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +  
      scale_fill_grey(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +
      scale_shape_discrete(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice")) 
figureA11 
ggsave(figureA11, width = 15, height = 8, units = c("cm"), file ="appendix/figureA11.pdf")
```

### Table A.10: OLS regressions for average treatment effects on party ues on support for Eurobonds and vote choice
```{r, results="asis"}
## table with 3 models for support and 3 models for vote choice
# support (recoded)

df$Treatment <- factor(df$Treatment, levels = c("Control", "In-party: In favour", "In-party: Against", "Out-party: Against", "Out-party: In favour"))

m1a_old <- lm(EBSupport_rec ~ Treatment, data=df)
m1b_old <- lm(EBSupport_rec ~ Treatment + Country_Name, data=df)
m1c_old <- lm(EBSupport_rec ~ Treatment + Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df)

# vote 
m2a_old <- lm(EBVote ~ Treatment, data=df)
m2b_old <- lm(EBVote ~ Treatment + Country_Name, data=df)
m2c_old <- lm(EBVote ~ Treatment + Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df)

stargazer(m1a_old, m1b_old, m1c_old, m2a_old, m2b_old, m2c_old, type = "latex",  no.space = TRUE, out="appendix/tableA10.tex", star.cutoffs = c(0.05, 0.01, 0.001), dep.var.labels = c("Support", "Vote choice"), covariate.labels = c("In-party: In favour", "In-party: Against", "Out-party: Against", "Out-party: In favour"), omit = c("Gender", "Age", "Age_sq", "Edu", "Inc", "Country_Name"), omit.stat = c("ser","f"), add.lines=list(c("Country-fixed effects?", "No", "Yes", "Yes", "No", "Yes", "Yes"), c("Controls?", "No", "No", "Yes", "No", "No", "Yes")), column.sep.width = "-10pt", font.size = "footnotesize", table.placement = "H", title = "OLS regressions for average treatment effects of party cues on support for Eurobonds and vote choice", label = "tab:main_models_old")
```

### Figure A.12: Using different models to estimate the average treatment effects of informing respondents about the positions of different types of parties on Eurobonds 
```{r, echo=FALSE, warning=FALSE, message=FALSE}
## use party-fixed effects for in-party model and out-party model
df_treatment_inparty <- df[which(df$Treatment=="Control" | df$Treatment=="In-party: In favour" | df$Treatment=="In-party: Against"),]

df_treatment_outparty <- df[which(df$Treatment=="Control" | df$Treatment=="Out-party: In favour" | df$Treatment=="Out-party: Against"),]

df_treatment_inparty$Treatment <- factor(df_treatment_inparty$Treatment, levels = c("Control", "In-party: In favour", "In-party: Against"))
df_treatment_outparty$Treatment <- factor(df_treatment_outparty$Treatment, levels = c("Control", "Out-party: In favour", "Out-party: Against"))

## in-party models
# support
m_in_1 <- lm(EBSupport_rec ~ Treatment + as.factor(QE1), data=df_treatment_inparty)
m_in_2 <- lm(EBSupport_rec ~ Treatment + as.factor(QE1) + Country_Name, data=df_treatment_inparty)
m_in_3 <- lm(EBSupport_rec ~ Treatment + as.factor(QE1) + Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment_inparty)

# vote 
m_in_4 <- lm(EBVote ~ Treatment + as.factor(QE1), data=df_treatment_inparty)
m_in_5 <- lm(EBVote ~ Treatment + Country_Name, data=df_treatment_inparty)
m_in_6 <- lm(EBVote ~ Treatment + Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment_inparty)

## out-party models
# support
m_out_1 <- lm(EBSupport_rec ~ Treatment + as.factor(QE2), data=df_treatment_outparty)
m_out_2 <- lm(EBSupport_rec ~ Treatment + as.factor(QE2) + Country_Name, data=df_treatment_outparty)
m_out_3 <- lm(EBSupport_rec ~ Treatment + as.factor(QE2) + Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment_outparty)

# vote 
m_out_4 <- lm(EBVote ~ Treatment + as.factor(QE2), data=df_treatment_outparty)
m_out_5 <- lm(EBVote ~ Treatment + as.factor(QE2) + Country_Name, data=df_treatment_outparty)
m_out_6 <- lm(EBVote ~ Treatment +  as.factor(QE2) + Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment_outparty)
```

```{r, echo=FALSE, warning=FALSE, message=FALSE}
## run models with clustered standard errors 

# support
m1b_se <- lm_robust(EBSupport_rec ~ Treatment + Country_Name + QE1, se_type = "stata", clusters = QE1, data=df_treatment1)
m2b_se <- lm_robust(EBSupport_rec ~ Treatment + Country_Name + QE1, se_type = "stata", clusters = QE1, data=df_treatment2)
m3b_se <- lm_robust(EBSupport_rec ~ Treatment + Country_Name + QE2, se_type = "stata", clusters = QE2, data=df_treatment3)
m4b_se <- lm_robust(EBSupport_rec ~ Treatment + Country_Name + QE2, se_type = "stata", clusters = QE2, data=df_treatment4)

# vote choice
m5b_se <- lm(EBVote ~ Treatment + Country_Name + QE1, se_type = "stata", clusters = QE1, data=df_treatment1)
m6b_se <- lm(EBVote ~ Treatment + Country_Name + QE1, se_type = "stata", clusters = QE1, data=df_treatment2)
m7b_se <- lm(EBVote ~ Treatment + Country_Name + QE2, se_type = "stata", clusters = QE2, data=df_treatment3)
m8b_se <- lm(EBVote ~ Treatment + Country_Name + QE2, se_type = "stata", clusters = QE, data=df_treatment4)
```

```{r, echo=FALSE, warning=FALSE, message=FALSE}
## create a combined plot to show the robustness

# re-run main models (matched)
m1b <- lm(EBSupport_rec ~ Treatment+ Country_Name, data=df_treatment1)
m2b <- lm(EBSupport_rec ~ Treatment+ Country_Name, data=df_treatment2)
m3b <- lm(EBSupport_rec ~ Treatment+ Country_Name, data=df_treatment3)
m4b <- lm(EBSupport_rec ~ Treatment+ Country_Name, data=df_treatment4)
m5b <- lm(EBVote ~ Treatment+ Country_Name, data=df_treatment1)
m6b <- lm(EBVote ~ Treatment+ Country_Name, data=df_treatment2)
m7b <- lm(EBVote ~ Treatment+ Country_Name, data=df_treatment3)
m8b <- lm(EBVote ~ Treatment+ Country_Name, data=df_treatment4)

# clean up matched models
# support 
m1b_df <- broom::tidy(m1b)
m1b_df$Model <- "Matched control"
m1b_df <- m1b_df[which(m1b_df$term=="TreatmentIn-party: In favour"),]

m2b_df <- broom::tidy(m2b)
m2b_df$Model <- "Matched control"
m2b_df <- m2b_df[which(m2b_df$term=="TreatmentIn-party: Against"),]

m3b_df <- broom::tidy(m3b)
m3b_df$Model <- "Matched control"
m3b_df <- m3b_df[which(m3b_df$term=="TreatmentOut-party: In favour"),]

m4b_df <- broom::tidy(m4b)
m4b_df$Model <- "Matched control"
m4b_df <- m4b_df[which(m4b_df$term=="TreatmentOut-party: Against"),]

# vote
m5b_df <- broom::tidy(m5b)
m5b_df$Model <- "Matched control"
m5b_df <- m5b_df[which(m5b_df$term=="TreatmentIn-party: In favour"),]

m6b_df <- broom::tidy(m6b)
m6b_df$Model <- "Matched control"
m6b_df <- m6b_df[which(m6b_df$term=="TreatmentIn-party: Against"),]

m7b_df <- broom::tidy(m7b)
m7b_df$Model <- "Matched control"
m7b_df <- m7b_df[which(m7b_df$term=="TreatmentOut-party: In favour"),]

m8b_df <- broom::tidy(m8b)
m8b_df$Model <- "Matched control"
m8b_df <- m8b_df[which(m8b_df$term=="TreatmentOut-party: Against"),]

# clean up party FE models
# support
m_in_1_df <- broom::tidy(m_in_1)
m_in_1_df <- m_in_1_df[which(m_in_1_df$term=="TreatmentIn-party: In favour" | m_in_1_df$term=="TreatmentIn-party: Against"),]
m_in_1_df$Model <- "Party FE"

m_out_1_df <- broom::tidy(m_out_1)
m_out_1_df <- m_out_1_df[which(m_out_1_df$term=="TreatmentOut-party: In favour" | m_out_1_df$term=="TreatmentOut-party: Against"),]
m_out_1_df$Model <- "Party FE"

# vote
m_in_4_df <- broom::tidy(m_in_4)
m_in_4_df <- m_in_4_df[which(m_in_4_df$term=="TreatmentIn-party: In favour" | m_in_4_df$term=="TreatmentIn-party: Against"),]
m_in_4_df$Model <- "Party FE"

m_out_4_df <- broom::tidy(m_out_4)
m_out_4_df <- m_out_4_df[which(m_out_4_df$term=="TreatmentOut-party: In favour" | m_out_4_df$term=="TreatmentOut-party: Against"),]
m_out_4_df$Model <- "Party FE"

# clean up models with party clustered SE
# support
m1b_se_df <- broom::tidy(m1b_se)
m1b_se_df$Model <- "Party clustered SE"
m1b_se_df <- m1b_se_df[which(m1b_se_df$term=="TreatmentIn-party: In favour"),]
m1b_se_df <- m1b_se_df[, !names(m1b_se_df) %in% c("conf.low", "conf.high", "df", "outcome")]

m2b_se_df <- broom::tidy(m2b_se)
m2b_se_df$Model <- "Party clustered SE"
m2b_se_df <- m2b_se_df[which(m2b_se_df$term=="TreatmentIn-party: Against"),]
m2b_se_df <- m2b_se_df[, !names(m2b_se_df) %in% c("conf.low", "conf.high", "df", "outcome")]

m3b_se_df <- broom::tidy(m3b_se)
m3b_se_df$Model <- "Party clustered SE"
m3b_se_df <- m3b_se_df[which(m3b_se_df$term=="TreatmentOut-party: In favour"),]
m3b_se_df <- m3b_se_df[, !names(m3b_se_df) %in% c("conf.low", "conf.high", "df", "outcome")]

m4b_se_df <- broom::tidy(m4b_se)
m4b_se_df$Model <- "Party clustered SE"
m4b_se_df <- m4b_se_df[which(m4b_se_df$term=="TreatmentOut-party: Against"),]
m4b_se_df <- m4b_se_df[, !names(m4b_se_df) %in% c("conf.low", "conf.high", "df", "outcome")]

# vote choice
m5b_se_df <- broom::tidy(m5b_se)
m5b_se_df$Model <- "Party clustered SE"
m5b_se_df <- m5b_se_df[which(m5b_se_df$term=="TreatmentIn-party: In favour"),]
m5b_se_df <- m5b_se_df[, !names(m5b_se_df) %in% c("conf.low", "conf.high", "df", "outcome")]

m6b_se_df <- broom::tidy(m6b_se)
m6b_se_df$Model <- "Party clustered SE"
m6b_se_df <- m6b_se_df[which(m6b_se_df$term=="TreatmentIn-party: Against"),]
m6b_se_df <- m6b_se_df[, !names(m6b_se_df) %in% c("conf.low", "conf.high", "df", "outcome")]

m7b_se_df <- broom::tidy(m7b_se)
m7b_se_df$Model <- "Party clustered SE"
m7b_se_df <- m7b_se_df[which(m7b_se_df$term=="TreatmentOut-party: In favour"),]
m7b_se_df <- m7b_se_df[, !names(m7b_se_df) %in% c("conf.low", "conf.high", "df", "outcome")]

m8b_se_df <- broom::tidy(m8b)
m8b_se_df$Model <- "Party clustered SE"
m8b_se_df <- m8b_se_df[which(m8b_se_df$term=="TreatmentOut-party: Against"),]
m8b_se_df <- m8b_se_df[, !names(m8b_se_df) %in% c("conf.low", "conf.high", "df", "outcome")]
```

```{r, echo=FALSE, warning=FALSE, message=FALSE}
# combine estimates and plot them

# model for support
support_df_pfe_fe <- rbind(m_in_1_df,m_out_1_df, m1b_df, m2b_df, m3b_df, m4b_df, m1b_se_df, m2b_se_df, m3b_se_df, m4b_se_df)

support_df_pfe_fe$upper95 <- support_df_pfe_fe$estimate + (support_df_pfe_fe$std.error*1.96)
support_df_pfe_fe$lower95 <- support_df_pfe_fe$estimate - (support_df_pfe_fe$std.error*1.96)
support_df_pfe_fe$Treatment <- ifelse(support_df_pfe_fe$term=="TreatmentIn-party: In favour", "In-party: In favour", ifelse(support_df_pfe_fe$term=="TreatmentIn-party: Against", "In-party: Against", ifelse(support_df_pfe_fe$term=="TreatmentOut-party: In favour", "Out-party: In favour", ifelse(support_df_pfe_fe$term=="TreatmentOut-party: Against", "Out-party: Against", NA))))
support_df_pfe_fe$Treatment <- factor(support_df_pfe_fe$Treatment, levels = c("Out-party: In favour", "Out-party: Against", "In-party: Against", "In-party: In favour"))

support_df_pfe_fe$Model <- factor(support_df_pfe_fe$Model, levels = c("Party FE", "Party clustered SE", "Matched control"))

figureA12a <- ggplot(support_df_pfe_fe, aes(colour = Model)) + 
  geom_errorbar(aes(y = Treatment, xmin=lower95, xmax=upper95), width=0, position=position_dodge(width=0.5)) + 
  geom_point(aes(y = Treatment, x=estimate, shape = Model), position = position_dodge(width=0.5), size=2) +
  theme_bw() + 
  scale_x_continuous(breaks=c(-0.4,-0.2,0,0.2,0.4), labels = c("-0.4", "-0.2", "0", "0.2", "0.4")) +
  geom_vline(xintercept=0, color="grey", linetype = "dashed") + 
      xlab("Average treatment effect") +
  ggtitle("Support") + 
  theme(plot.title = element_text(face = "bold")) +
  xlim(-0.22, 0.22) + 
      scale_color_grey(name = "Model", breaks = c("Matched control", "Party clustered SE", "Party FE"), labels = c("Matched control", "Party clustered SE", "Party FE"), start = 0.7, end = 0, aesthetics = "colour") +  
      scale_fill_grey(name = "Model",  breaks = c("Matched control", "Party clustered SE", "Party FE"), labels = c("Matched control", "Party clustered SE", "Party FE"), start = 0.7, end = 0, aesthetics = "colour") +
      scale_shape_discrete(name = "Model",  breaks = c("Matched control", "Party clustered SE", "Party FE"), labels = c("Matched control", "Party clustered SE", "Party FE")) 

# model for vote
vote_df_pfe_se <- rbind(m_in_4_df,m_out_4_df,m5b_df,m6b_df,m7b_df,m8b_df, m5b_se_df, m6b_se_df, m7b_se_df, m8b_se_df)

vote_df_pfe_se$upper95 <- vote_df_pfe_se$estimate + (vote_df_pfe_se$std.error*1.96)
vote_df_pfe_se$lower95 <- vote_df_pfe_se$estimate - (vote_df_pfe_se$std.error*1.96)
vote_df_pfe_se$Treatment <- ifelse(vote_df_pfe_se$term=="TreatmentIn-party: In favour", "In-party: In favour", ifelse(vote_df_pfe_se$term=="TreatmentIn-party: Against", "In-party: Against", ifelse(vote_df_pfe_se$term=="TreatmentOut-party: In favour", "Out-party: In favour", ifelse(vote_df_pfe_se$term=="TreatmentOut-party: Against", "Out-party: Against", NA))))
vote_df_pfe_se$Treatment <- factor(vote_df_pfe_se$Treatment, levels = c("Out-party: In favour", "Out-party: Against", "In-party: Against", "In-party: In favour"))

vote_df_pfe_se$Model <- factor(vote_df_pfe_se$Model, levels = c("Party FE", "Party clustered SE", "Matched control"))

figureA12b <- ggplot(vote_df_pfe_se, aes(colour = Model)) + 
  geom_errorbar(aes(y = Treatment, xmin=lower95, xmax=upper95), width=0, position=position_dodge(width=0.5)) + 
  geom_point(aes(y = Treatment, x=estimate, shape = Model), position = position_dodge(width=0.5), size=2) +
  theme_bw() + 
  scale_x_continuous(breaks=c(-0.4,-0.2,0,0.2,0.4), labels = c("-0.4", "-0.2", "0", "0.2", "0.4")) +
  geom_vline(xintercept=0, color="grey", linetype = "dashed") + 
      xlab("Average treatment effect") +
  ggtitle("Vote Choice") + 
  theme(plot.title = element_text(face = "bold")) +
  xlim(-0.22, 0.22)  + 
      scale_color_grey(name = "Model", breaks = c("Matched control", "Party clustered SE", "Party FE"), labels = c("Matched control", "Party clustered SE", "Party FE"), start = 0.7, end = 0, aesthetics = "colour") +  
      scale_fill_grey(name = "Model",  breaks = c("Matched control", "Party clustered SE", "Party FE"), labels = c("Matched control", "Party clustered SE", "Party FE"), start = 0.7, end = 0, aesthetics = "colour") +
      scale_shape_discrete(name = "Model",  breaks = c("Matched control", "Party clustered SE", "Party FE"), labels = c("Matched control", "Party clustered SE", "Party FE")) 

# create a combined plot for support and vote and save it
figureA12 <- ggarrange(figureA12a, figureA12b, common.legend = TRUE, legend = "bottom")
figureA12
ggsave(figureA12, width = 21, height = 12, units = c("cm"), file ="appendix/figureA12.pdf")
```

### Figure A.13: Support for Eurobonds by treatment group
```{r}
## calculate means and se for all country by treatment group
# support
mean_df_support <- df %>% group_by(Treatment) %>% 
                       summarise(N = sum(!is.na(EBSupport_rec)),
                                 mean = mean(EBSupport_rec,  na.rm=TRUE),
                                 sd = sd(EBSupport_rec,  na.rm=TRUE),
                                 se = sd / sqrt(N))
mean_df_support$Model <- "Support"

# vote
mean_df_vote <- df %>% group_by(Treatment) %>%                                  
                                summarise( N = sum(!is.na(EBVote)),
                                 mean = mean(EBVote,  na.rm=TRUE),
                                sd = sd(EBVote,  na.rm=TRUE),
                                 se = sd / sqrt(N))
mean_df_vote$Model <- "Vote choice"

# combine the estimates
mean_df <- rbind(mean_df_support, mean_df_vote)
mean_df <- mean_df[which(!is.na(mean_df$Treatment)),]

## barplot with CIs by treatment group
figureA13a <- ggplot(mean_df, aes(x = Treatment, y=mean, fill=Model)) +
  geom_bar(stat="identity", position = position_dodge(width=0.9)) +
  geom_errorbar(aes(ymin=mean-(1.96*se), ymax=mean+(1.96*se)), width=0.5, color="black", position = position_dodge(width=0.9)) +
  ylab("Share")  +
  theme_bw() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) + 
  scale_fill_grey(start = 0.4, end = 0.8, aesthetics = "fill") +
  geom_hline(yintercept = 0.5, colour = "black", linetype = 2) 
figureA13a
ggsave(figureA13a, width = 20, height = 14, units = c("cm"), file ="appendix/figureA13a.pdf")
```

```{r}
## calculate means and se by treatment group and country

# support by country
mean_df_support_country <- df %>% group_by(Treatment, Country_Name) %>% 
                       summarise(N = sum(!is.na(EBSupport_rec)),
                                 mean = mean(EBSupport_rec,  na.rm=TRUE),
                                 sd = sd(EBSupport_rec,  na.rm=TRUE),
                                 se = sd / sqrt(N))
mean_df_support_country$Model <- "Support"

# vote by country
mean_df_vote_country <- df %>% group_by(Treatment, Country_Name) %>%                                  
                                summarise( N = sum(!is.na(EBVote)),
                                 mean = mean(EBVote,  na.rm=TRUE),
                                sd = sd(EBVote,  na.rm=TRUE),
                                 se = sd / sqrt(N))
mean_df_vote_country$Model <- "Vote choice"

# combine the estimates
mean_df_country <- rbind(mean_df_support_country, mean_df_vote_country)
mean_df_country <- mean_df_country[which(!is.na(mean_df_country$Treatment)),]

## bar plot with CIs by treatment group and country
figureA13b <- ggplot(mean_df_country, aes(x = Treatment, y=mean, fill=Model)) +
  geom_bar(stat="identity", position = position_dodge(width=0.9)) + facet_wrap(~Country_Name) +
  geom_errorbar(aes(ymin=mean-(1.96*se), ymax=mean+(1.96*se)), color="black", width = 0.5, position = position_dodge(width=0.9))  +
  ylab("Share") +
  theme_bw() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))  + 
  scale_fill_grey(start = 0.4, end = 0.8, aesthetics = "fill") +
  geom_hline(yintercept = 0.5, colour = "black", linetype = 2) 
figureA13b
ggsave(figureA13b, width = 20, height = 14, units = c("cm"), file ="appendix/figureA13b.pdf")
```

### Figure A.14: Average treatment effects of party cues on support for Eurobonds including "no vote" cue 
```{r}
## calculate the ates on support and vote choice
m1a <- lm(EBSupport_rec ~ Treatment_all, data=df_treatment1)
m1b <- lm(EBSupport_rec ~ Treatment_all+ Country_Name, data=df_treatment1)
m1c <- lm(EBSupport_rec ~ Treatment_all+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment1)
m2a <- lm(EBSupport_rec ~ Treatment_all, data=df_treatment2)
m2b <- lm(EBSupport_rec ~ Treatment_all+ Country_Name, data=df_treatment2)
m2c <- lm(EBSupport_rec ~ Treatment_all+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment2)
m3a <- lm(EBSupport_rec ~ Treatment_all, data=df_treatment3)
m3b <- lm(EBSupport_rec ~ Treatment_all+ Country_Name, data=df_treatment3)
m3c <- lm(EBSupport_rec ~ Treatment_all+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment3)
m4a <- lm(EBSupport_rec ~ Treatment_all, data=df_treatment4)
m4b <- lm(EBSupport_rec ~ Treatment_all+ Country_Name, data=df_treatment4)
m4c <- lm(EBSupport_rec ~ Treatment_all+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment4)
m5a <- lm(EBSupport_rec ~ Treatment_all, data=df_treatment5)
m5b <- lm(EBSupport_rec ~ Treatment_all+ Country_Name, data=df_treatment5)
m5c <- lm(EBSupport_rec ~ Treatment_all+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment5)
m6a <- lm(EBSupport_rec ~ Treatment_all, data=df_treatment6)
m6b <- lm(EBSupport_rec ~ Treatment_all+ Country_Name, data=df_treatment6)
m6c <- lm(EBSupport_rec ~ Treatment_all+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment6)

m1a_df <- broom::tidy(m1a)
m1a_df$Model <- "No covariates"
m1a_df <- m1a_df[which(m1a_df$term=="Treatment_allIn-party: In favour"),]
m1b_df <- broom::tidy(m1b)
m1b_df$Model <- "Country FE"
m1b_df <- m1b_df[which(m1b_df$term=="Treatment_allIn-party: In favour"),]
m1c_df <- broom::tidy(m1c)
m1c_df$Model <- "Covariates + country FE"
m1c_df <- m1c_df[which(m1c_df$term=="Treatment_allIn-party: In favour"),]
m2a_df <- broom::tidy(m2a)
m2a_df$Model <- "No covariates"
m2a_df <- m2a_df[which(m2a_df$term=="Treatment_allIn-party: Against"),]
m2b_df <- broom::tidy(m2b)
m2b_df$Model <- "Country FE"
m2b_df <- m2b_df[which(m2b_df$term=="Treatment_allIn-party: Against"),]
m2c_df <- broom::tidy(m2c)
m2c_df$Model <- "Covariates + country FE"
m2c_df <- m2c_df[which(m2c_df$term=="Treatment_allIn-party: Against"),]
m3a_df <- broom::tidy(m3a)
m3a_df$Model <- "No covariates"
m3a_df <- m3a_df[which(m3a_df$term=="Treatment_allOut-party: In favour"),]
m3b_df <- broom::tidy(m3b)
m3b_df$Model <- "Country FE"
m3b_df <- m3b_df[which(m3b_df$term=="Treatment_allOut-party: In favour"),]
m3c_df <- broom::tidy(m3c)
m3c_df$Model <- "Covariates + country FE"
m3c_df <- m3c_df[which(m3c_df$term=="Treatment_allOut-party: In favour"),]
m4a_df <- broom::tidy(m4a)
m4a_df$Model <- "No covariates"
m4a_df <- m4a_df[which(m4a_df$term=="Treatment_allOut-party: Against"),]
m4b_df <- broom::tidy(m4b)
m4b_df$Model <- "Country FE"
m4b_df <- m4b_df[which(m4b_df$term=="Treatment_allOut-party: Against"),]
m4c_df <- broom::tidy(m4c)
m4c_df$Model <- "Covariates + country FE"
m4c_df <- m4c_df[which(m4c_df$term=="Treatment_allOut-party: Against"),]
m5a_df <- broom::tidy(m5a)
m5a_df$Model <- "No covariates"
m5a_df <- m5a_df[which(m5a_df$term=="Treatment_allIn-party: No vote"),]
m5b_df <- broom::tidy(m5b)
m5b_df$Model <- "Country FE"
m5b_df <- m5b_df[which(m5b_df$term=="Treatment_allIn-party: No vote"),]
m5c_df <- broom::tidy(m5c)
m5c_df$Model <- "Covariates + country FE"
m5c_df <- m5c_df[which(m5c_df$term=="Treatment_allIn-party: No vote"),]
m6a_df <- broom::tidy(m6a)
m6a_df$Model <- "No covariates"
m6a_df <- m6a_df[which(m6a_df$term=="Treatment_allOut-party: No vote"),]
m6b_df <- broom::tidy(m6b)
m6b_df$Model <- "Country FE"
m6b_df <- m6b_df[which(m6b_df$term=="Treatment_allOut-party: No vote"),]
m6c_df <- broom::tidy(m6c)
m6c_df$Model <- "Covariates + country FE"
m6c_df <- m6c_df[which(m6c_df$term=="Treatment_allOut-party: No vote"),]

support_df_all <- rbind(m1a_df, m1b_df, m1c_df, m2a_df, m2b_df, m2c_df, m3a_df, m3b_df, m3c_df, m4a_df, m4b_df, m4c_df, m5a_df, m5b_df, m5c_df, m6a_df, m6b_df, m6c_df)
rm(m1a_df, m1b_df, m1c_df, m2a_df, m2b_df, m2c_df, m3a_df, m3b_df, m3c_df, m4a_df, m4b_df, m4c_df, m5a_df, m5b_df, m5c_df, m6a_df, m6b_df, m6c_df)
support_df_all$upper95 <- support_df_all$estimate + (support_df_all$std.error*1.96)
support_df_all$lower95 <- support_df_all$estimate - (support_df_all$std.error*1.96)
support_df_all$Treatment_all <- ifelse(support_df_all$term=="Treatment_allIn-party: In favour", "In-party: In favour", ifelse(support_df_all$term=="Treatment_allIn-party: Against", "In-party: Against", ifelse(support_df_all$term=="Treatment_allIn-party: No vote", "In-party: No vote", ifelse(support_df_all$term=="Treatment_allOut-party: In favour", "Out-party: In favour", ifelse(support_df_all$term=="Treatment_allOut-party: Against", "Out-party: Against", ifelse(support_df_all$term=="Treatment_allOut-party: No vote", "Out-party: No vote",NA))))))
support_df_all$Treatment_all <- factor(support_df_all$Treatment_all, levels = c("Out-party: No vote", "Out-party: In favour", "Out-party: Against", "In-party: No vote", "In-party: Against", "In-party: In favour"))

figureA14a <- ggplot(support_df_all, aes(colour = Model)) + 
  geom_errorbar(aes(y = Treatment_all, xmin=lower95, xmax=upper95), width=0, position=position_dodge(width=0.5)) + 
  geom_point(aes(y = Treatment_all, x=estimate, shape = Model), position = position_dodge(width=0.5), size=2) +
  theme_bw() + scale_color_grey(start = 0.7, end = 0) + 
  scale_fill_grey(start = 0.7, end = 0) + 
  scale_x_continuous(breaks=c(-0.4,-0.2,0,0.2,0.4), labels = c("-0.4", "-0.2", "0", "0.2", "0.4")) +
  scale_shape_discrete() +
  geom_vline(xintercept=0, color="grey", linetype = "dashed") + 
      xlab("Average treatment effect") + ylab("Treatment") + 
  ggtitle("Support") + 
  theme(plot.title = element_text(face = "bold")) +
  xlim(-0.2, 0.2)  

m5a <- lm(EBVote ~ Treatment_all, data=df_treatment1)
m5b <- lm(EBVote ~ Treatment_all+ Country_Name, data=df_treatment1)
m5c <- lm(EBVote ~ Treatment_all+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment1)
m6a <- lm(EBVote ~ Treatment_all, data=df_treatment2)
m6b <- lm(EBVote ~ Treatment_all+ Country_Name, data=df_treatment2)
m6c <- lm(EBVote ~ Treatment_all+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment2)
m7a <- lm(EBVote ~ Treatment_all, data=df_treatment3)
m7b <- lm(EBVote ~ Treatment_all+ Country_Name, data=df_treatment3)
m7c <- lm(EBVote ~ Treatment_all+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment3)
m8a <- lm(EBVote ~ Treatment_all, data=df_treatment4)
m8b <- lm(EBVote ~ Treatment_all+ Country_Name, data=df_treatment4)
m8c <- lm(EBVote ~ Treatment_all+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment4)
m9a <- lm(EBVote ~ Treatment_all, data=df_treatment5)
m9b <- lm(EBVote ~ Treatment_all+ Country_Name, data=df_treatment5)
m9c <- lm(EBVote ~ Treatment_all+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment5)
m10a <- lm(EBVote ~ Treatment_all, data=df_treatment6)
m10b <- lm(EBVote ~ Treatment_all+ Country_Name, data=df_treatment6)
m10c <- lm(EBVote ~ Treatment_all+ Country_Name + Gender + Age + Age_sq + Edu + Inc, data=df_treatment6)

m5a_df <- broom::tidy(m5a)
m5a_df$Model <- "No covariates"
m5a_df <- m5a_df[which(m5a_df$term=="Treatment_allIn-party: In favour"),]
m5b_df <- broom::tidy(m5b)
m5b_df$Model <- "Country FE"
m5b_df <- m5b_df[which(m5b_df$term=="Treatment_allIn-party: In favour"),]
m5c_df <- broom::tidy(m5c)
m5c_df$Model <- "Covariates + country FE"
m5c_df <- m5c_df[which(m5c_df$term=="Treatment_allIn-party: In favour"),]
m6a_df <- broom::tidy(m6a)
m6a_df$Model <- "No covariates"
m6a_df <- m6a_df[which(m6a_df$term=="Treatment_allIn-party: Against"),]
m6b_df <- broom::tidy(m6b)
m6b_df$Model <- "Country FE"
m6b_df <- m6b_df[which(m6b_df$term=="Treatment_allIn-party: Against"),]
m6c_df <- broom::tidy(m6c)
m6c_df$Model <- "Covariates + country FE"
m6c_df <- m6c_df[which(m6c_df$term=="Treatment_allIn-party: Against"),]
m7a_df <- broom::tidy(m7a)
m7a_df$Model <- "No covariates"
m7a_df <- m7a_df[which(m7a_df$term=="Treatment_allOut-party: In favour"),]
m7b_df <- broom::tidy(m7b)
m7b_df$Model <- "Country FE"
m7b_df <- m7b_df[which(m7b_df$term=="Treatment_allOut-party: In favour"),]
m7c_df <- broom::tidy(m7c)
m7c_df$Model <- "Covariates + country FE"
m7c_df <- m7c_df[which(m7c_df$term=="Treatment_allOut-party: In favour"),]
m8a_df <- broom::tidy(m8a)
m8a_df$Model <- "No covariates"
m8a_df <- m8a_df[which(m8a_df$term=="Treatment_allOut-party: Against"),]
m8b_df <- broom::tidy(m8b)
m8b_df$Model <- "Country FE"
m8b_df <- m8b_df[which(m8b_df$term=="Treatment_allOut-party: Against"),]
m8c_df <- broom::tidy(m8c)
m8c_df$Model <- "Covariates + country FE"
m8c_df <- m8c_df[which(m8c_df$term=="Treatment_allOut-party: Against"),]
m9a_df <- broom::tidy(m9a)
m9a_df$Model <- "No covariates"
m9a_df <- m9a_df[which(m9a_df$term=="Treatment_allIn-party: No vote"),]
m9b_df <- broom::tidy(m9b)
m9b_df$Model <- "Country FE"
m9b_df <- m9b_df[which(m9b_df$term=="Treatment_allIn-party: No vote"),]
m9c_df <- broom::tidy(m9c)
m9c_df$Model <- "Covariates + country FE"
m9c_df <- m9c_df[which(m9c_df$term=="Treatment_allIn-party: No vote"),]
m10a_df <- broom::tidy(m10a)
m10a_df$Model <- "No covariates"
m10a_df <- m10a_df[which(m10a_df$term=="Treatment_allOut-party: No vote"),]
m10b_df <- broom::tidy(m10b)
m10b_df$Model <- "Country FE"
m10b_df <- m10b_df[which(m10b_df$term=="Treatment_allOut-party: No vote"),]
m10c_df <- broom::tidy(m10c)
m10c_df$Model <- "Covariates + country FE"
m10c_df <- m10c_df[which(m10c_df$term=="Treatment_allOut-party: No vote"),]

vote_df_all <- rbind(m5a_df, m5b_df, m5c_df, m6a_df, m6b_df, m6c_df, m7a_df, m7b_df, m7c_df, m8a_df, m8b_df, m8c_df, m9a_df, m9b_df, m9c_df, m10a_df, m10b_df, m10c_df)
rm(m5a_df, m5b_df, m5c_df, m6a_df, m6b_df, m6c_df, m7a_df, m7b_df, m7c_df, m8a_df, m8b_df, m8c_df, m9a_df, m9b_df, m9c_df, m10a_df, m10b_df, m10c_df)
vote_df_all$upper95 <- vote_df_all$estimate + (vote_df_all$std.error*1.96)
vote_df_all$lower95 <- vote_df_all$estimate - (vote_df_all$std.error*1.96)
vote_df_all$Treatment_all <- ifelse(vote_df_all$term=="Treatment_allIn-party: In favour", "In-party: In favour", ifelse(vote_df_all$term=="Treatment_allIn-party: Against", "In-party: Against", ifelse(vote_df_all$term=="Treatment_allIn-party: No vote", "In-party: No vote", ifelse(vote_df_all$term=="Treatment_allOut-party: In favour", "Out-party: In favour", ifelse(vote_df_all$term=="Treatment_allOut-party: Against", "Out-party: Against", ifelse(vote_df_all$term=="Treatment_allOut-party: No vote", "Out-party: No vote",NA))))))
vote_df_all$Treatment_all <- factor(vote_df_all$Treatment_all, levels = c("Out-party: No vote", "Out-party: In favour", "Out-party: Against", "In-party: No vote", "In-party: Against", "In-party: In favour"))

figureA14b <- ggplot(vote_df_all, aes(colour = Model)) + 
  geom_errorbar(aes(y = Treatment_all, xmin=lower95, xmax=upper95), width=0, position=position_dodge(width=0.5)) + 
  geom_point(aes(y = Treatment_all, x=estimate, shape = Model), position = position_dodge(width=0.5), size=2) +
  theme_bw() + scale_color_grey(start = 0.7, end = 0) + 
  scale_fill_grey(start = 0.7, end = 0) + 
  scale_x_continuous(breaks=c(-0.4,-0.2,0,0.2,0.4), labels = c("-0.4", "-0.2", "0", "0.2", "0.4")) +
  scale_shape_discrete() +
  geom_vline(xintercept=0, color="grey", linetype = "dashed") + 
      xlab("Average treatment effect") + ylab("Treatment") + 
  ggtitle("Vote") + 
  theme(plot.title = element_text(face = "bold")) +
  xlim(-0.2, 0.2)  

#create a combined plot for support and vote and save it
figureA14 <- ggarrange(figureA14a, figureA14b, common.legend = TRUE, legend = "bottom")
figureA14
ggsave(figureA14, width = 21, height = 12, units = c("cm"), file ="appendix/figureA14.pdf")
```

### Tables A.11 and A.12: Multi-level models regession models to estimate average treatment effects of party cues on support for Eurobonds
```{r}
## calculate the ates on support and vote choice
m1a_ml <- lmer(EBSupport_rec ~ Treatment + (1 | Country_Name), data = df_treatment1)
m1b_ml <- lmer(EBSupport_rec ~ Treatment + Gender + Age + Age_sq + Edu + Inc + (1 | Country_Name), data = df_treatment1)
m2a_ml <- lmer(EBSupport_rec ~ Treatment + (1 | Country_Name), data = df_treatment2)
m2b_ml <- lmer(EBSupport_rec ~ Treatment + Gender + Age + Age_sq + Edu + Inc + (1 | Country_Name), data = df_treatment2)
m3a_ml <- lmer(EBSupport_rec ~ Treatment + (1 | Country_Name), data = df_treatment3)
m3b_ml <- lmer(EBSupport_rec ~ Treatment + Gender + Age + Age_sq + Edu + Inc + (1 | Country_Name), data = df_treatment3)
m4a_ml <- lmer(EBSupport_rec ~ Treatment + (1 | Country_Name), data = df_treatment4)
m4b_ml <- lmer(EBSupport_rec ~ Treatment + Gender + Age + Age_sq + Edu + Inc + (1 | Country_Name), data = df_treatment4)

m5a_ml <- lmer(EBVote ~ Treatment + (1 | Country_Name), data = df_treatment1)
m5b_ml <- lmer(EBVote ~ Treatment + Gender + Age + Age_sq + Edu + Inc + (1 | Country_Name), data = df_treatment1)
m6a_ml <- lmer(EBVote ~ Treatment + (1 | Country_Name), data = df_treatment2)
m6b_ml <- lmer(EBVote ~ Treatment + Gender + Age + Age_sq + Edu + Inc + (1 | Country_Name), data = df_treatment2)
m7a_ml <- lmer(EBVote ~ Treatment + (1 | Country_Name), data = df_treatment3)
m7b_ml <- lmer(EBVote ~ Treatment + Gender + Age + Age_sq + Edu + Inc + (1 | Country_Name), data = df_treatment3)
m8a_ml <- lmer(EBVote ~ Treatment + (1 | Country_Name), data = df_treatment4)
m8b_ml <- lmer(EBVote ~ Treatment + Gender + Age + Age_sq + Edu + Inc + (1 | Country_Name), data = df_treatment4)

# Combine the models into a list
models <- list(
  "1" = m1a_ml,
  "2" = m2a_ml,
  "3" = m4a_ml,
  "4" = m3a_ml,
  "5" = m1b_ml,
  "6" = m2b_ml,
  "7" = m4b_ml,
  "8" = m3b_ml
)

# Define the covariate labels
cm <- c(
  "TreatmentIn-party: In favour" = "In-party: In favour",
  "TreatmentIn-party: Against" = "In-party: Against",
  "TreatmentOut-party: Against" = "Out-party: Against",
  "TreatmentOut-party: In favour" = "Out-party: In favour",
  "SD (Intercept Country_Name)" = "SD (Intercept Country)",
  "SD (Observations)" = "SD (Individual)"
)

# Define custom notes
rows <- tribble(~term, ~"1", ~"2", ~"3", ~"4", ~"5", ~"6", ~"7", ~"8",
                "","Support", "", "", "", "", "", "", "",
                "Country-fixed effects", "No", "No", "No", "No", "Yes", "Yes", "Yes", "Yes")
                
attr(rows, 'position') <- c(1,12)

# Create the regression table
modelsummary(
  models,
  coef_map = cm,
  output = "appendix/tableA11.tex",
  stars = c("*" = 0.05, "**" = 0.01, "***" = 0.001),
  title = "Multi-level regression models to estimate average treatment effects of party cues on support for Eurobonds",
  label = "tab:main_models_support_ml",
  fmt = 3,
  size = "footnotesize",
  add_rows = rows,
  escape = FALSE,
  shape = term ~ model 
  )

models_vote <- list(
  "1" = m5a_ml,
  "2" = m6a_ml,
  "3" = m8a_ml,
  "4" = m7a_ml,
  "5" = m5b_ml,
  "6" = m6b_ml,
  "7" = m8b_ml,
  "8" = m7b_ml
)

rows <- tribble(~term, ~"1", ~"2", ~"3", ~"4", ~"5", ~"6", ~"7", ~"8",
                "","Vote", "", "", "", "", "", "", "",
                "Country-fixed effects", "No", "No", "No", "No", "Yes", "Yes", "Yes", "Yes")
                
attr(rows, 'position') <- c(1,12)

# Create the regression table
modelsummary(
  models_vote,
  coef_map = cm,
  output = "appendix/tableA12.tex",
  stars = c("*" = 0.05, "**" = 0.01, "***" = 0.001),
  title = "Multi-level regression models to estimate average treatment effects of party cues on vote for Eurobonds",
  label = "tab:main_models_vote_ml",
  fmt = 3,
  size = "footnotesize",
  add_rows = rows,
   escape = FALSE,
  shape = term ~ model 
  )
```

### Tables A.13, A.14, and A.15: Other operationalization of the vote variable 
```{r, results="asis"}
mA.1b <- lm(EBVote_fav ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data=df_treatment1)
mA.1d <- lm(EBVote_no ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data=df_treatment1)
mA.2b <- lm(EBVote_fav ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data=df_treatment2)
mA.2d <- lm(EBVote_no ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data=df_treatment2)
mA.3b <- lm(EBVote_fav ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data=df_treatment3)
mA.3d <- lm(EBVote_no ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data=df_treatment3)
mA.4b <- lm(EBVote_fav ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data=df_treatment4)
mA.4d <- lm(EBVote_no ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data=df_treatment4)

stargazer(mA.1b, mA.1d, mA.2b, mA.2d, mA.4b, mA.4d, mA.3b, mA.3d,  type = "latex", no.space = TRUE, out="appendix/tableA13.tex", star.cutoffs = c(0.05, 0.01, 0.001), dep.var.labels = c("In favour", "No vote", "In favour", "No vote", "In favour", "No vote", "In favour", "No vote"), column.sep.width = "-12pt", omit.stat = c("ser","f"), font.size = "footnotesize", table.placement = "htbp", title = "OLS regressions for average treatment effect of party cues on voting in favour (vs. against) and not voting (vs. against)", label = "tab:vote_variable", covariate.labels = c("In-party: In favour", "In-party: Against", "Out-party: Against", "Out-party: In favour"), omit = c("Gender", "Age", "Age_sq", "Edu", "Inc", "Country_Name"), add.lines=list(c("Country-fixed effects?", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes"), c("Controls?", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes")))
```

```{r, results="asis"}
# ols vs. logit 
mA.1b <- lm(EBVote ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data=df_treatment1)
mA.1d <- glm(EBVote ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data = df_treatment1, family = "binomial")
mA.2b <- lm(EBVote ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data=df_treatment2)
mA.2d <- glm(EBVote ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data = df_treatment2, family = "binomial")
mA.3b <- lm(EBVote ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data=df_treatment3)
mA.3d <- glm(EBVote ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data = df_treatment3, family = "binomial")
mA.4b <- lm(EBVote ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data=df_treatment4)
mA.4d <- glm(EBVote ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data = df_treatment4, family = "binomial")

stargazer(mA.1b, mA.1d, mA.2b, mA.2d, mA.4b, mA.4d, mA.3b, mA.3d, type = "latex", no.space = TRUE, out="appendix/tableA14.tex", star.cutoffs = c(0.05, 0.01, 0.001), dep.var.labels = c("OLS", "Log.", "OLS", "Log.", "OLS", "Log.", "OLS", "Log."), column.sep.width = "-12pt", omit.stat = c("ser","f"), font.size = "footnotesize", table.placement = "htbp", title = "OLS regressions and logistic regressions for average treatment effect of party cues on vote choice", label = "tab:vote_ols_logistic", covariate.labels = c("In-party: In favour", "In-party: Against", "Out-party: Against", "Out-party: In favour"), omit = c("Gender", "Age", "Age_sq", "Edu", "Inc", "Country_Name"), add.lines=list(c("Country-fixed effects?", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes"), c("Controls?", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes")))
```

```{r, results="asis"}
m.A5b <- multinom(EBVote_cat_rec1 ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data = df_treatment1, trace = FALSE) 
m.A5d <- multinom(EBVote_cat_rec2 ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data = df_treatment1, trace = FALSE) 
m.A6b <- multinom(EBVote_cat_rec1 ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data = df_treatment2, trace = FALSE) 
m.A6d <- multinom(EBVote_cat_rec2 ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data = df_treatment2, trace = FALSE)
m.A7b <- multinom(EBVote_cat_rec1 ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data = df_treatment3, trace = FALSE) 
m.A7d <- multinom(EBVote_cat_rec2 ~ Treatment + Gender + Age + Age_sq + Edu + Inc + Country_Name, data = df_treatment3, trace = FALSE)
m.A8b <- multinom(EBVote_cat_rec1 ~ Treatment + Country_Name + Gender + Age + Age_sq + Edu + Inc + Country_Name, data = df_treatment4, trace = FALSE) 
m.A8d <- multinom(EBVote_cat_rec2 ~ Treatment + Country_Name + Gender + Age + Age_sq + Edu + Inc + Country_Name, data = df_treatment4, trace = FALSE)

stargazer(m.A5b, m.A5d, m.A6b, m.A6d, m.A8b, m.A8d, m.A7b, m.A7d, type = "latex", no.space = TRUE, out="appendix/tableA15.tex", star.cutoffs = c(0.05, 0.01, 0.001), dep.var.labels = c("In favour", "No vote", "In favour", "No vote", "In favour", "No vote", "In favour", "No vote"), column.sep.width = "-12pt", omit.stat = c("ser","f"), font.size = "footnotesize", table.placement = "htbp", title = "Multinomial regression for average treatment effect of party cues on vote choice", label = "tab:vote_multinom", covariate.labels = c( "In-party: In favour", "In-party: Against", "Out-party: Against", "Out-party: In favour"), omit = c("Gender", "Age", "Age_sq", "Edu", "Inc", "Country_Name"), add.lines=list(c("Country-fixed effects?", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes"), c("Controls?", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes")))
```

### Figure A.15: Heterogenous treatment effects of party cues on support for Eurobonds by left-right position
```{r}
## use margins package to calculate HTS by LRposition
m1 <- lm(EBSupport_rec ~ Treatment*LRposition, data=df_treatment1)
m2 <- lm(EBVote ~ Treatment*LRposition, data=df_treatment1)
m3 <- lm(EBSupport_rec ~ Treatment*LRposition, data=df_treatment2)
m4 <- lm(EBVote ~ Treatment*LRposition, data=df_treatment2)
m5 <- lm(EBSupport_rec ~ Treatment*LRposition, data=df_treatment3)
m6 <- lm(EBVote ~ Treatment*LRposition, data=df_treatment3)
m7 <- lm(EBSupport_rec ~ Treatment*LRposition, data=df_treatment4)
m8 <- lm(EBVote ~ Treatment*LRposition, data=df_treatment4)

ma1 <- margins(m1, variables = "Treatment", at = list(LRposition = c("Left", "Center", "Right")))
ame_lrposition1 <- as.data.frame(summary(ma1))
ame_lrposition1$Treatment <- ame_lrposition1$factor
ame_lrposition1$upper95 <- ame_lrposition1$AME + (ame_lrposition1$SE*1.96)
ame_lrposition1$lower95 <- ame_lrposition1$AME - (ame_lrposition1$SE*1.96)
ame_lrposition1$Model <- "Support"

ma2 <- margins(m2, variables = "Treatment", at = list(LRposition = c("Left", "Center", "Right")))
ame_lrposition2 <- as.data.frame(summary(ma2))
ame_lrposition2$Treatment <- ame_lrposition2$factor
ame_lrposition2$upper95 <- ame_lrposition2$AME + (ame_lrposition2$SE*1.96)
ame_lrposition2$lower95 <- ame_lrposition2$AME - (ame_lrposition2$SE*1.96)
ame_lrposition2$Model <- "Vote choice"

ma3 <- margins(m3, variables = "Treatment", at = list(LRposition = c("Left", "Center", "Right")))
ame_lrposition3 <- as.data.frame(summary(ma3))
ame_lrposition3$Treatment <- ame_lrposition3$factor
ame_lrposition3$upper95 <- ame_lrposition3$AME + (ame_lrposition3$SE*1.96)
ame_lrposition3$lower95 <- ame_lrposition3$AME - (ame_lrposition3$SE*1.96)
ame_lrposition3$Model <- "Support"

ma4 <- margins(m4, variables = "Treatment", at = list(LRposition = c("Left", "Center", "Right")))
ame_lrposition4 <- as.data.frame(summary(ma4))
ame_lrposition4$Treatment <- ame_lrposition4$factor
ame_lrposition4$upper95 <- ame_lrposition4$AME + (ame_lrposition4$SE*1.96)
ame_lrposition4$lower95 <- ame_lrposition4$AME - (ame_lrposition4$SE*1.96)
ame_lrposition4$Model <- "Vote choice"

ma5 <- margins(m5, variables = "Treatment", at = list(LRposition = c("Left", "Center", "Right")))
ame_lrposition5 <- as.data.frame(summary(ma5))
ame_lrposition5$Treatment <- ame_lrposition5$factor
ame_lrposition5$upper95 <- ame_lrposition5$AME + (ame_lrposition5$SE*1.96)
ame_lrposition5$lower95 <- ame_lrposition5$AME - (ame_lrposition5$SE*1.96)
ame_lrposition5$Model <- "Support"

ma6 <- margins(m6, variables = "Treatment", at = list(LRposition = c("Left", "Center", "Right")))
ame_lrposition6 <- as.data.frame(summary(ma6))
ame_lrposition6$Treatment <- ame_lrposition6$factor
ame_lrposition6$upper95 <- ame_lrposition6$AME + (ame_lrposition6$SE*1.96)
ame_lrposition6$lower95 <- ame_lrposition6$AME - (ame_lrposition6$SE*1.96)
ame_lrposition6$Model <- "Vote choice"

ma7 <- margins(m7, variables = "Treatment", at = list(LRposition = c("Left", "Center", "Right")))
ame_lrposition7 <- as.data.frame(summary(ma7))
ame_lrposition7$Treatment <- ame_lrposition7$factor
ame_lrposition7$upper95 <- ame_lrposition7$AME + (ame_lrposition7$SE*1.96)
ame_lrposition7$lower95 <- ame_lrposition7$AME - (ame_lrposition7$SE*1.96)
ame_lrposition7$Model <- "Support"

ma8 <- margins(m8, variables = "Treatment", at = list(LRposition = c("Left", "Center", "Right")))
ame_lrposition8 <- as.data.frame(summary(ma8))
ame_lrposition8$Treatment <- ame_lrposition8$factor
ame_lrposition8$upper95 <- ame_lrposition8$AME + (ame_lrposition8$SE*1.96)
ame_lrposition8$lower95 <- ame_lrposition8$AME - (ame_lrposition8$SE*1.96)
ame_lrposition8$Model <- "Vote choice"

ame_lrposition <- rbind(ame_lrposition1, ame_lrposition2, ame_lrposition3, ame_lrposition4, ame_lrposition5, ame_lrposition6, ame_lrposition7, ame_lrposition8)
ame_lrposition$Treatment[ame_lrposition$Treatment=="TreatmentIn-party: Against"] <- "In-party: Against"
ame_lrposition$Treatment[ame_lrposition$Treatment=="TreatmentOut-party: Against"] <- "Out-party: Against"
ame_lrposition$Treatment[ame_lrposition$Treatment=="TreatmentIn-party: In favour"] <- "In-party: In favour"
ame_lrposition$Treatment[ame_lrposition$Treatment=="TreatmentOut-party: In favour"] <- "Out-party: In favour"

ame_lrposition$Treatment <- factor(ame_lrposition$Treatment, levels = c("Out-party: In favour", "Out-party: Against", "In-party: Against", "In-party: In favour"))

ame_lrposition$Model <- factor(ame_lrposition$Model, levels = c("Vote choice", "Support"))

# plot the ates by lrposition
figureA15 <- ggplot(ame_lrposition, aes(colour = Model)) + 
  geom_errorbar(aes(y = Treatment, xmin=lower95, xmax=upper95), width=0, position=position_dodge(width=0.5)) + 
  geom_point(aes(y = Treatment, x=AME, shape = Model), position = position_dodge(width=0.5), size=2) +
  theme_bw() + facet_wrap(~LRposition) +
  xlim(-0.47, 0.47) +
  scale_x_continuous(breaks=c(-0.4,-0.2,0,0.2,0.4), labels = c("-0.4", "-0.2", "0", "0.2", "0.4")) +
  geom_vline(xintercept=0, color="grey", linetype = "dashed") + 
      xlab("Average treatment effect") + 
        scale_color_grey(name = "Model", breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +  
      scale_fill_grey(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +
      scale_shape_discrete(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice")) 
figureA15 
ggsave(figureA15, width = 15, height = 8, units = c("cm"), file ="appendix/figureA15.pdf")
```

### Figure A.16: Heterogenous treatment effects of party cues on support for Eurobonds by national identity
```{r}
## use margins package to calculate HTS by Identity
m1 <- lm(EBSupport_rec ~ Treatment*Identity, data=df_treatment1)
m2 <- lm(EBVote ~ Treatment*Identity, data=df_treatment1)
m3 <- lm(EBSupport_rec ~ Treatment*Identity, data=df_treatment2)
m4 <- lm(EBVote ~ Treatment*Identity, data=df_treatment2)
m5 <- lm(EBSupport_rec ~ Treatment*Identity, data=df_treatment3)
m6 <- lm(EBVote ~ Treatment*Identity, data=df_treatment3)
m7 <- lm(EBSupport_rec ~ Treatment*Identity, data=df_treatment4)
m8 <- lm(EBVote ~ Treatment*Identity, data=df_treatment4)

ma1 <- margins(m1, variables = "Treatment", at = list(Identity = c("Exclusive national identity", "No exclusive national identity")))
ame_identity1 <- as.data.frame(summary(ma1))
ame_identity1$Treatment <- ame_identity1$factor
ame_identity1$upper95 <- ame_identity1$AME + (ame_identity1$SE*1.96)
ame_identity1$lower95 <- ame_identity1$AME - (ame_identity1$SE*1.96)
ame_identity1$Model <- "Support"

ma2 <- margins(m2, variables = "Treatment", at = list(Identity = c("Exclusive national identity", "No exclusive national identity")))
ame_identity2 <- as.data.frame(summary(ma2))
ame_identity2$Treatment <- ame_identity2$factor
ame_identity2$upper95 <- ame_identity2$AME + (ame_identity2$SE*1.96)
ame_identity2$lower95 <- ame_identity2$AME - (ame_identity2$SE*1.96)
ame_identity2$Model <- "Vote choice"

ma3 <- margins(m3, variables = "Treatment", at = list(Identity = c("Exclusive national identity", "No exclusive national identity")))
ame_identity3 <- as.data.frame(summary(ma3))
ame_identity3$Treatment <- ame_identity3$factor
ame_identity3$upper95 <- ame_identity3$AME + (ame_identity3$SE*1.96)
ame_identity3$lower95 <- ame_identity3$AME - (ame_identity3$SE*1.96)
ame_identity3$Model <- "Support"

ma4 <- margins(m4, variables = "Treatment", at = list(Identity = c("Exclusive national identity", "No exclusive national identity")))
ame_identity4 <- as.data.frame(summary(ma4))
ame_identity4$Treatment <- ame_identity4$factor
ame_identity4$upper95 <- ame_identity4$AME + (ame_identity4$SE*1.96)
ame_identity4$lower95 <- ame_identity4$AME - (ame_identity4$SE*1.96)
ame_identity4$Model <- "Vote choice"

ma5 <- margins(m5, variables = "Treatment", at = list(Identity = c("Exclusive national identity", "No exclusive national identity")))
ame_identity5 <- as.data.frame(summary(ma5))
ame_identity5$Treatment <- ame_identity5$factor
ame_identity5$upper95 <- ame_identity5$AME + (ame_identity5$SE*1.96)
ame_identity5$lower95 <- ame_identity5$AME - (ame_identity5$SE*1.96)
ame_identity5$Model <- "Support"

ma6 <- margins(m6, variables = "Treatment", at = list(Identity = c("Exclusive national identity", "No exclusive national identity")))
ame_identity6 <- as.data.frame(summary(ma6))
ame_identity6$Treatment <- ame_identity6$factor
ame_identity6$upper95 <- ame_identity6$AME + (ame_identity6$SE*1.96)
ame_identity6$lower95 <- ame_identity6$AME - (ame_identity6$SE*1.96)
ame_identity6$Model <- "Vote choice"

ma7 <- margins(m7, variables = "Treatment", at = list(Identity = c("Exclusive national identity", "No exclusive national identity")))
ame_identity7 <- as.data.frame(summary(ma7))
ame_identity7$Treatment <- ame_identity7$factor
ame_identity7$upper95 <- ame_identity7$AME + (ame_identity7$SE*1.96)
ame_identity7$lower95 <- ame_identity7$AME - (ame_identity7$SE*1.96)
ame_identity7$Model <- "Support"

ma8 <- margins(m8, variables = "Treatment", at = list(Identity = c("Exclusive national identity", "No exclusive national identity")))
ame_identity8 <- as.data.frame(summary(ma8))
ame_identity8$Treatment <- ame_identity8$factor
ame_identity8$upper95 <- ame_identity8$AME + (ame_identity8$SE*1.96)
ame_identity8$lower95 <- ame_identity8$AME - (ame_identity8$SE*1.96)
ame_identity8$Model <- "Vote choice"

ame_identity <- rbind(ame_identity1, ame_identity2, ame_identity3, ame_identity4, ame_identity5, ame_identity6, ame_identity7, ame_identity8)
ame_identity$Treatment[ame_identity$Treatment=="TreatmentIn-party: Against"] <- "In-party: Against"
ame_identity$Treatment[ame_identity$Treatment=="TreatmentOut-party: Against"] <- "Out-party: Against"
ame_identity$Treatment[ame_identity$Treatment=="TreatmentIn-party: In favour"] <- "In-party: In favour"
ame_identity$Treatment[ame_identity$Treatment=="TreatmentOut-party: In favour"] <- "Out-party: In favour"

ame_identity$Treatment <- factor(ame_identity$Treatment, levels = c("Out-party: In favour", "Out-party: Against", "In-party: Against", "In-party: In favour"))

ame_identity$Model <- factor(ame_identity$Model, levels = c("Vote choice", "Support"))

# plot the ates by identity
figureA16 <- ggplot(ame_identity, aes(colour = Model)) + 
  geom_errorbar(aes(y = Treatment, xmin=lower95, xmax=upper95), width=0, position=position_dodge(width=0.5)) + 
  geom_point(aes(y = Treatment, x=AME, shape = Model), position = position_dodge(width=0.5), size=2) +
  theme_bw() + facet_wrap(~Identity) + 
  xlim(-0.47, 0.47) +
  scale_x_continuous(breaks=c(-0.4,-0.2,0,0.2,0.4), labels = c("-0.4", "-0.2", "0", "0.2", "0.4")) +
  geom_vline(xintercept=0, color="grey", linetype = "dashed") + 
      xlab("Average treatment effect") +
        scale_color_grey(name = "Model", breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +  
      scale_fill_grey(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +
      scale_shape_discrete(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice")) 
figureA16 
ggsave(figureA16, width = 15, height = 8, units = c("cm"), file ="appendix/figureA16.pdf")
```

### Figure A.17: Heterogenous treatment effects of party cues on support for Eurobonds by COVID-19 economic risk exposure
```{r}
## use margins package to calculate HTS by COVIDeconomic
m1 <- lm(EBSupport_rec ~ Treatment*COVIDeconomic, data=df_treatment1)
m2 <- lm(EBVote ~ Treatment*COVIDeconomic, data=df_treatment1)
m3 <- lm(EBSupport_rec ~ Treatment*COVIDeconomic, data=df_treatment2)
m4 <- lm(EBVote ~ Treatment*COVIDeconomic, data=df_treatment2)
m5 <- lm(EBSupport_rec ~ Treatment*COVIDeconomic, data=df_treatment3)
m6 <- lm(EBVote ~ Treatment*COVIDeconomic, data=df_treatment3)
m7 <- lm(EBSupport_rec ~ Treatment*COVIDeconomic, data=df_treatment4)
m8 <- lm(EBVote ~ Treatment*COVIDeconomic, data=df_treatment4)

ma1 <- margins(m1, variables = "Treatment", at = list(COVIDeconomic = c("Concerned", "Not concerned")))
ame_covideconomic1 <- as.data.frame(summary(ma1))
ame_covideconomic1$Treatment <- ame_covideconomic1$factor
ame_covideconomic1$upper95 <- ame_covideconomic1$AME + (ame_covideconomic1$SE*1.96)
ame_covideconomic1$lower95 <- ame_covideconomic1$AME - (ame_covideconomic1$SE*1.96)
ame_covideconomic1$Model <- "Support"

ma2 <- margins(m2, variables = "Treatment", at = list(COVIDeconomic = c("Concerned", "Not concerned")))
ame_covideconomic2 <- as.data.frame(summary(ma2))
ame_covideconomic2$Treatment <- ame_covideconomic2$factor
ame_covideconomic2$upper95 <- ame_covideconomic2$AME + (ame_covideconomic2$SE*1.96)
ame_covideconomic2$lower95 <- ame_covideconomic2$AME - (ame_covideconomic2$SE*1.96)
ame_covideconomic2$Model <- "Vote choice"

ma3 <- margins(m3, variables = "Treatment", at = list(COVIDeconomic = c("Concerned", "Not concerned")))
ame_covideconomic3 <- as.data.frame(summary(ma3))
ame_covideconomic3$Treatment <- ame_covideconomic3$factor
ame_covideconomic3$upper95 <- ame_covideconomic3$AME + (ame_covideconomic3$SE*1.96)
ame_covideconomic3$lower95 <- ame_covideconomic3$AME - (ame_covideconomic3$SE*1.96)
ame_covideconomic3$Model <- "Support"

ma4 <- margins(m4, variables = "Treatment", at = list(COVIDeconomic = c("Concerned", "Not concerned")))
ame_covideconomic4 <- as.data.frame(summary(ma4))
ame_covideconomic4$Treatment <- ame_covideconomic4$factor
ame_covideconomic4$upper95 <- ame_covideconomic4$AME + (ame_covideconomic4$SE*1.96)
ame_covideconomic4$lower95 <- ame_covideconomic4$AME - (ame_covideconomic4$SE*1.96)
ame_covideconomic4$Model <- "Vote choice"

ma5 <- margins(m5, variables = "Treatment", at = list(COVIDeconomic = c("Concerned", "Not concerned")))
ame_covideconomic5 <- as.data.frame(summary(ma5))
ame_covideconomic5$Treatment <- ame_covideconomic5$factor
ame_covideconomic5$upper95 <- ame_covideconomic5$AME + (ame_covideconomic5$SE*1.96)
ame_covideconomic5$lower95 <- ame_covideconomic5$AME - (ame_covideconomic5$SE*1.96)
ame_covideconomic5$Model <- "Support"

ma6 <- margins(m6, variables = "Treatment", at = list(COVIDeconomic = c("Concerned", "Not concerned")))
ame_covideconomic6 <- as.data.frame(summary(ma6))
ame_covideconomic6$Treatment <- ame_covideconomic6$factor
ame_covideconomic6$upper95 <- ame_covideconomic6$AME + (ame_covideconomic6$SE*1.96)
ame_covideconomic6$lower95 <- ame_covideconomic6$AME - (ame_covideconomic6$SE*1.96)
ame_covideconomic6$Model <- "Vote choice"

ma7 <- margins(m7, variables = "Treatment", at = list(COVIDeconomic = c("Concerned", "Not concerned")))
ame_covideconomic7 <- as.data.frame(summary(ma7))
ame_covideconomic7$Treatment <- ame_covideconomic7$factor
ame_covideconomic7$upper95 <- ame_covideconomic7$AME + (ame_covideconomic7$SE*1.96)
ame_covideconomic7$lower95 <- ame_covideconomic7$AME - (ame_covideconomic7$SE*1.96)
ame_covideconomic7$Model <- "Support"

ma8 <- margins(m8, variables = "Treatment", at = list(COVIDeconomic = c("Concerned", "Not concerned")))
ame_covideconomic8 <- as.data.frame(summary(ma8))
ame_covideconomic8$Treatment <- ame_covideconomic8$factor
ame_covideconomic8$upper95 <- ame_covideconomic8$AME + (ame_covideconomic8$SE*1.96)
ame_covideconomic8$lower95 <- ame_covideconomic8$AME - (ame_covideconomic8$SE*1.96)
ame_covideconomic8$Model <- "Vote choice"

ame_covideconomic <- rbind(ame_covideconomic1, ame_covideconomic2, ame_covideconomic3, ame_covideconomic4, ame_covideconomic5, ame_covideconomic6, ame_covideconomic7, ame_covideconomic8)
ame_covideconomic$Treatment[ame_covideconomic$Treatment=="TreatmentIn-party: Against"] <- "In-party: Against"
ame_covideconomic$Treatment[ame_covideconomic$Treatment=="TreatmentOut-party: Against"] <- "Out-party: Against"
ame_covideconomic$Treatment[ame_covideconomic$Treatment=="TreatmentIn-party: In favour"] <- "In-party: In favour"
ame_covideconomic$Treatment[ame_covideconomic$Treatment=="TreatmentOut-party: In favour"] <- "Out-party: In favour"

ame_covideconomic$Treatment <- factor(ame_covideconomic$Treatment, levels = c("Out-party: In favour", "Out-party: Against", "In-party: Against", "In-party: In favour"))

ame_covideconomic$Model <- factor(ame_covideconomic$Model, levels = c("Vote choice", "Support"))

# plot the ates by covideconomic
figureA17 <- ggplot(ame_covideconomic, aes(colour = Model)) + 
  geom_errorbar(aes(y = Treatment, xmin=lower95, xmax=upper95), width=0, position=position_dodge(width=0.5)) + 
  geom_point(aes(y = Treatment, x=AME, shape = Model), position = position_dodge(width=0.5), size=2) +
  theme_bw() + facet_wrap(~COVIDeconomic) + 
  scale_x_continuous(limits=c(-0.3, 0.3), breaks=c(-0.4,-0.2,0,0.2,0.4), labels = c("-0.4", "-0.2", "0", "0.2", "0.4")) +
  geom_vline(xintercept=0, color="grey", linetype = "dashed") + 
      xlab("Average treatment effect") + 
        scale_color_grey(name = "Model", breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +  
      scale_fill_grey(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +
      scale_shape_discrete(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice")) 
figureA17 
ggsave(figureA17, width = 15, height = 8, units = c("cm"), file ="appendix/figureA17.pdf")
```

### Figure A.18: Heterogenous treatment effects of party cues on support for Eurobonds by education
```{r}
## use margins package to calculate HTS by Edu
m1 <- lm(EBSupport_rec ~ Treatment*Edu, data=df_treatment1)
m2 <- lm(EBVote ~ Treatment*Edu, data=df_treatment1)
m3 <- lm(EBSupport_rec ~ Treatment*Edu, data=df_treatment2)
m4 <- lm(EBVote ~ Treatment*Edu, data=df_treatment2)
m5 <- lm(EBSupport_rec ~ Treatment*Edu, data=df_treatment3)
m6 <- lm(EBVote ~ Treatment*Edu, data=df_treatment3)
m7 <- lm(EBSupport_rec ~ Treatment*Edu, data=df_treatment4)
m8 <- lm(EBVote ~ Treatment*Edu, data=df_treatment4)

ma1 <- margins(m1, variables = "Treatment", at = list(Edu = c("Low", "Middle", "High")))
ame_education1 <- as.data.frame(summary(ma1))
ame_education1$Treatment <- ame_education1$factor
ame_education1$upper95 <- ame_education1$AME + (ame_education1$SE*1.96)
ame_education1$lower95 <- ame_education1$AME - (ame_education1$SE*1.96)
ame_education1$Model <- "Support"

ma2 <- margins(m2, variables = "Treatment", at = list(Edu = c("Low", "Middle", "High")))
ame_education2 <- as.data.frame(summary(ma2))
ame_education2$Treatment <- ame_education2$factor
ame_education2$upper95 <- ame_education2$AME + (ame_education2$SE*1.96)
ame_education2$lower95 <- ame_education2$AME - (ame_education2$SE*1.96)
ame_education2$Model <- "Vote choice"

ma3 <- margins(m3, variables = "Treatment", at = list(Edu = c("Low", "Middle", "High")))
ame_education3 <- as.data.frame(summary(ma3))
ame_education3$Treatment <- ame_education3$factor
ame_education3$upper95 <- ame_education3$AME + (ame_education3$SE*1.96)
ame_education3$lower95 <- ame_education3$AME - (ame_education3$SE*1.96)
ame_education3$Model <- "Support"

ma4 <- margins(m4, variables = "Treatment", at = list(Edu = c("Low", "Middle", "High")))
ame_education4 <- as.data.frame(summary(ma4))
ame_education4$Treatment <- ame_education4$factor
ame_education4$upper95 <- ame_education4$AME + (ame_education4$SE*1.96)
ame_education4$lower95 <- ame_education4$AME - (ame_education4$SE*1.96)
ame_education4$Model <- "Vote choice"

ma5 <- margins(m5, variables = "Treatment", at = list(Edu = c("Low", "Middle", "High")))
ame_education5 <- as.data.frame(summary(ma5))
ame_education5$Treatment <- ame_education5$factor
ame_education5$upper95 <- ame_education5$AME + (ame_education5$SE*1.96)
ame_education5$lower95 <- ame_education5$AME - (ame_education5$SE*1.96)
ame_education5$Model <- "Support"

ma6 <- margins(m6, variables = "Treatment", at = list(Edu = c("Low", "Middle", "High")))
ame_education6 <- as.data.frame(summary(ma6))
ame_education6$Treatment <- ame_education6$factor
ame_education6$upper95 <- ame_education6$AME + (ame_education6$SE*1.96)
ame_education6$lower95 <- ame_education6$AME - (ame_education6$SE*1.96)
ame_education6$Model <- "Vote choice"

ma7 <- margins(m7, variables = "Treatment", at = list(Edu = c("Low", "Middle", "High")))
ame_education7 <- as.data.frame(summary(ma7))
ame_education7$Treatment <- ame_education7$factor
ame_education7$upper95 <- ame_education7$AME + (ame_education7$SE*1.96)
ame_education7$lower95 <- ame_education7$AME - (ame_education7$SE*1.96)
ame_education7$Model <- "Support"

ma8 <- margins(m8, variables = "Treatment", at = list(Edu = c("Low", "Middle", "High")))
ame_education8 <- as.data.frame(summary(ma8))
ame_education8$Treatment <- ame_education8$factor
ame_education8$upper95 <- ame_education8$AME + (ame_education8$SE*1.96)
ame_education8$lower95 <- ame_education8$AME - (ame_education8$SE*1.96)
ame_education8$Model <- "Vote choice"

ame_education <- rbind(ame_education1, ame_education2, ame_education3, ame_education4, ame_education5, ame_education6, ame_education7, ame_education8)
ame_education$Treatment[ame_education$Treatment=="TreatmentIn-party: Against"] <- "In-party: Against"
ame_education$Treatment[ame_education$Treatment=="TreatmentOut-party: Against"] <- "Out-party: Against"
ame_education$Treatment[ame_education$Treatment=="TreatmentIn-party: In favour"] <- "In-party: In favour"
ame_education$Treatment[ame_education$Treatment=="TreatmentOut-party: In favour"] <- "Out-party: In favour"

ame_education$Treatment <- factor(ame_education$Treatment, levels = c("Out-party: In favour", "Out-party: Against", "In-party: Against", "In-party: In favour"))

ame_education$Model <- factor(ame_education$Model, levels = c("Vote choice", "Support"))

# plot the ates by education
figureA18 <- ggplot(ame_education, aes(colour = Model)) + 
  geom_errorbar(aes(y = Treatment, xmin=lower95, xmax=upper95), width=0, position=position_dodge(width=0.5)) + 
  geom_point(aes(y = Treatment, x=AME, shape = Model), position = position_dodge(width=0.5), size=2) +
  theme_bw() + facet_wrap(~Edu) + 
  scale_x_continuous(limits=c(-0.3, 0.3),breaks=c(-0.4,-0.2,0,0.2,0.4), labels = c("-0.4", "-0.2", "0", "0.2", "0.4")) +
  geom_vline(xintercept=0, color="grey", linetype = "dashed") + 
      xlab("Average treatment effect") + 
        scale_color_grey(name = "Model", breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +  
      scale_fill_grey(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +
      scale_shape_discrete(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice")) 
figureA18
ggsave(figureA18, width = 15, height = 8, units = c("cm"), file ="appendix/figureA18.pdf")

```

### Figure A.19: Heterogenous treatment effects of party cues on support for Eurobonds by national by support for a challenger vs. mainstream party party (Figure A.15)
```{r}
# coding challenger parties
df$challenger_DE <- ifelse(df$Q32_DE==6 |df$Q32_DE==3 |df$Q32_DE==2 |df$Q32_DE==1, 0, ifelse(df$Q32_DE==4 |df$Q32_DE==5, 1, NA))
df$challenger_NL <- ifelse(df$Q32_NL==2 |df$Q32_NL==7 |df$Q32_NL==8 |df$Q32_NL==10 |df$Q32_NL==9 |df$Q32_NL==12 |df$Q32_NL==4, 1, ifelse(df$Q32_NL==14|df$Q32_NL==13 |df$Q32_NL==11 |df$Q32_NL==6 |df$Q32_NL==5 |df$Q32_NL==3 |df$Q32_NL==1, 0, NA))
df$challenger_FR <- ifelse(df$Q32_FR==1 |df$Q32_FR==6 |df$Q32_FR==5 |df$Q32_FR==12 |df$Q32_FR==3, 1, ifelse(df$Q32_FR==2 |df$Q32_FR==4 |df$Q32_FR==7 |df$Q32_FR==8 |df$Q32_FR==9 |df$Q32_FR==10 |df$Q32_FR==11 |df$Q32_FR==14 |df$Q32_FR==13, 0, NA))
df$challenger_ES <- ifelse(df$Q32_ES==15 |df$Q32_ES==14 |df$Q32_ES==13 |df$Q32_ES==12 |df$Q32_ES==11 |df$Q32_ES==10 |df$Q32_ES==9 |df$Q32_ES==8 |df$Q32_ES==7 |df$Q32_ES==6 |df$Q32_ES==5 |df$Q32_ES==3, 1, ifelse(df$Q32_ES==1 |df$Q32_ES==2 |df$Q32_ES==4, 0, NA)) 
df$challenger_IT <- ifelse(df$Q32_IT==4, 1, ifelse(df$Q32_IT==11 |df$Q32_IT==10 |df$Q32_IT== 9|df$Q32_IT==8 |df$Q32_IT==7 |df$Q32_IT==6 |df$Q32_IT==5 |df$Q32_IT==3 |df$Q32_IT==2 |df$Q32_IT==1, 0, NA))

df$challenger <- rowSums(df[,c("challenger_DE", "challenger_ES", "challenger_FR", "challenger_IT", "challenger_NL")], na.rm=TRUE)
df$challenger[is.na(df$challenger_DE) & is.na(df$challenger_ES) & is.na(df$challenger_FR) & is.na(df$challenger_IT & is.na(df$challenger_NL))] <- NA
df$challenger <- factor(df$challenger, levels = c(0,1), labels = c("Mainstream party", "Challenger party"))

# coding opposition parties
df$opposition_DE <- ifelse(df$Q32_DE==6 |df$Q32_DE==5 |df$Q32_DE==4 |df$Q32_DE==3, 1, ifelse(df$Q32_DE==1 |df$Q32_DE==2, 0, NA))
df$opposition_NL <- ifelse(df$Q32_NL==1 |df$Q32_NL==6 |df$Q32_NL==5 |df$Q32_NL==11, 1 ,ifelse(df$Q32_NL==14 |df$Q32_NL==13 |df$Q32_NL==12 |df$Q32_NL==10 |df$Q32_NL==9 |df$Q32_NL==8 |df$Q32_NL==7 |df$Q32_NL==4 |df$Q32_NL==3 |df$Q32_NL==2, 0, NA))
df$opposition_FR <- ifelse(df$Q32_FR==2 |df$Q32_FR==12, 1, ifelse(df$Q32_FR==15 |df$Q32_FR==13 |df$Q32_FR==14 |df$Q32_FR==11 |df$Q32_FR==10 |df$Q32_FR==9 |df$Q32_FR==8 |df$Q32_FR==7 |df$Q32_FR==6 |df$Q32_FR==5 |df$Q32_FR==4 |df$Q32_FR==3 |df$Q32_FR==1,0 ,NA))
df$opposition_IT <- ifelse(df$Q32_IT==3 |df$Q32_IT==2 |df$Q32_IT==6, 1, ifelse(df$Q32_IT==9 |df$Q32_IT==8 |df$Q32_IT==7 |df$Q32_IT==5 |df$Q32_IT==4 |df$Q32_IT==1, 0, NA))
df$opposition_ES <- ifelse(df$Q32_ES==1  |df$Q32_ES==4, 1 ,ifelse(df$Q32_ES==2 |df$Q32_ES==3 |df$Q32_ES==5 |df$Q32_ES==6 |df$Q32_ES==7 |df$Q32_ES==8 |df$Q32_ES==9 |df$Q32_ES==10 |df$Q32_ES==11 |df$Q32_ES==12 |df$Q32_ES==13 |df$Q32_ES==14 |df$Q32_ES==15, 0, NA))

df$opposition <- rowSums(df[,c("opposition_DE", "opposition_ES", "opposition_FR", "opposition_IT", "opposition_NL")], na.rm=TRUE)
df$opposition[is.na(df$opposition_DE) & is.na(df$opposition_ES) & is.na(df$opposition_FR) & is.na(df$opposition_IT & is.na(df$opposition_NL))] <- NA
df$opposition <- factor(df$opposition, levels = c(0,1), labels = c("Government party", "Opposition party"))

df_treatment1 <- df[which(df$Treatment=="Control" & df$inparty_vote=="In favour" |df$Treatment=="In-party: In favour"),]
df_treatment2 <- df[which(df$Treatment=="Control" & df$inparty_vote=="Against" |df$Treatment=="In-party: Against"),]
df_treatment3 <- df[which(df$Treatment=="Control" & df$outparty_vote=="In favour" |df$Treatment=="Out-party: In favour"),]
df_treatment4 <- df[which(df$Treatment=="Control" & df$outparty_vote=="Against" |df$Treatment=="Out-party: Against"),]

df_treatment1$Treatment <- factor(df_treatment1$Treatment, levels = c("Control", "In-party: In favour"))
df_treatment2$Treatment <- factor(df_treatment2$Treatment, levels = c("Control", "In-party: Against"))
df_treatment3$Treatment <- factor(df_treatment3$Treatment, levels = c("Control", "Out-party: In favour"))
df_treatment4$Treatment <- factor(df_treatment4$Treatment, levels = c("Control", "Out-party: Against"))
```

```{r}
## use margins package to calculate HTS by challenger
m1 <- lm(EBSupport_rec ~ Treatment*challenger, data=df_treatment1)
m2 <- lm(EBVote ~ Treatment*challenger, data=df_treatment1)
m3 <- lm(EBSupport_rec ~ Treatment*challenger, data=df_treatment2)
m4 <- lm(EBVote ~ Treatment*challenger, data=df_treatment2)
m5 <- lm(EBSupport_rec ~ Treatment*challenger, data=df_treatment3)
m6 <- lm(EBVote ~ Treatment*challenger, data=df_treatment3)
m7 <- lm(EBSupport_rec ~ Treatment*challenger, data=df_treatment4)
m8 <- lm(EBVote ~ Treatment*challenger, data=df_treatment4)

ma1 <- margins(m1, variables = "Treatment", at = list(challenger = c("Mainstream party", "Challenger party")))
ame_challenger1 <- as.data.frame(summary(ma1))
ame_challenger1$Treatment <- ame_challenger1$factor
ame_challenger1$upper95 <- ame_challenger1$AME + (ame_challenger1$SE*1.96)
ame_challenger1$lower95 <- ame_challenger1$AME - (ame_challenger1$SE*1.96)
ame_challenger1$Model <- "Support"

ma2 <- margins(m2, variables = "Treatment", at = list(challenger = c("Mainstream party", "Challenger party")))
ame_challenger2 <- as.data.frame(summary(ma2))
ame_challenger2$Treatment <- ame_challenger2$factor
ame_challenger2$upper95 <- ame_challenger2$AME + (ame_challenger2$SE*1.96)
ame_challenger2$lower95 <- ame_challenger2$AME - (ame_challenger2$SE*1.96)
ame_challenger2$Model <- "Vote choice"

ma3 <- margins(m3, variables = "Treatment", at = list(challenger = c("Mainstream party", "Challenger party")))
ame_challenger3 <- as.data.frame(summary(ma3))
ame_challenger3$Treatment <- ame_challenger3$factor
ame_challenger3$upper95 <- ame_challenger3$AME + (ame_challenger3$SE*1.96)
ame_challenger3$lower95 <- ame_challenger3$AME - (ame_challenger3$SE*1.96)
ame_challenger3$Model <- "Support"

ma4 <- margins(m4, variables = "Treatment", at = list(challenger = c("Mainstream party", "Challenger party")))
ame_challenger4 <- as.data.frame(summary(ma4))
ame_challenger4$Treatment <- ame_challenger4$factor
ame_challenger4$upper95 <- ame_challenger4$AME + (ame_challenger4$SE*1.96)
ame_challenger4$lower95 <- ame_challenger4$AME - (ame_challenger4$SE*1.96)
ame_challenger4$Model <- "Vote choice"

ma5 <- margins(m5, variables = "Treatment", at = list(challenger = c("Mainstream party", "Challenger party")))
ame_challenger5 <- as.data.frame(summary(ma5))
ame_challenger5$Treatment <- ame_challenger5$factor
ame_challenger5$upper95 <- ame_challenger5$AME + (ame_challenger5$SE*1.96)
ame_challenger5$lower95 <- ame_challenger5$AME - (ame_challenger5$SE*1.96)
ame_challenger5$Model <- "Support"

ma6 <- margins(m6, variables = "Treatment", at = list(challenger = c("Mainstream party", "Challenger party")))
ame_challenger6 <- as.data.frame(summary(ma6))
ame_challenger6$Treatment <- ame_challenger6$factor
ame_challenger6$upper95 <- ame_challenger6$AME + (ame_challenger6$SE*1.96)
ame_challenger6$lower95 <- ame_challenger6$AME - (ame_challenger6$SE*1.96)
ame_challenger6$Model <- "Vote choice"

ma7 <- margins(m7, variables = "Treatment", at = list(challenger = c("Mainstream party", "Challenger party")))
ame_challenger7 <- as.data.frame(summary(ma7))
ame_challenger7$Treatment <- ame_challenger7$factor
ame_challenger7$upper95 <- ame_challenger7$AME + (ame_challenger7$SE*1.96)
ame_challenger7$lower95 <- ame_challenger7$AME - (ame_challenger7$SE*1.96)
ame_challenger7$Model <- "Support"

ma8 <- margins(m8, variables = "Treatment", at = list(challenger = c("Mainstream party", "Challenger party")))
ame_challenger8 <- as.data.frame(summary(ma8))
ame_challenger8$Treatment <- ame_challenger8$factor
ame_challenger8$upper95 <- ame_challenger8$AME + (ame_challenger8$SE*1.96)
ame_challenger8$lower95 <- ame_challenger8$AME - (ame_challenger8$SE*1.96)
ame_challenger8$Model <- "Vote choice"

ame_challenger <- rbind(ame_challenger1, ame_challenger2, ame_challenger3, ame_challenger4, ame_challenger5, ame_challenger6, ame_challenger7, ame_challenger8)
ame_challenger$Treatment[ame_challenger$Treatment=="TreatmentIn-party: Against"] <- "In-party: Against"
ame_challenger$Treatment[ame_challenger$Treatment=="TreatmentOut-party: Against"] <- "Out-party: Against"
ame_challenger$Treatment[ame_challenger$Treatment=="TreatmentIn-party: In favour"] <- "In-party: In favour"
ame_challenger$Treatment[ame_challenger$Treatment=="TreatmentOut-party: In favour"] <- "Out-party: In favour"

ame_challenger$Treatment <- factor(ame_challenger$Treatment, levels = c("Out-party: In favour", "Out-party: Against", "In-party: Against", "In-party: In favour"))

ame_challenger$Model <- factor(ame_challenger$Model, levels = c("Vote choice", "Support"))

# plot the ates by challenger
figureA19 <- ggplot(ame_challenger, aes(colour = Model)) + 
  geom_errorbar(aes(y = Treatment, xmin=lower95, xmax=upper95), width=0, position=position_dodge(width=0.5)) + 
  geom_point(aes(y = Treatment, x=AME, shape = Model), position = position_dodge(width=0.5), size=2) +
  theme_bw() + facet_wrap(~challenger) + 
  scale_x_continuous(limits=c(-0.35, 0.35),breaks=c(-0.4,-0.2,0,0.2,0.4), labels = c("-0.4", "-0.2", "0", "0.2", "0.4")) +
  geom_vline(xintercept=0, color="grey", linetype = "dashed") + 
      xlab("Average treatment effect") + 
        scale_color_grey(name = "Model", breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +  
      scale_fill_grey(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +
      scale_shape_discrete(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice")) 
figureA19 
ggsave(figureA19, width = 15, height = 8, units = c("cm"), file ="appendix/figureA19.pdf")
```

#### Figure A.20: Heterogenous treatment effects of party cues on support for Eurobonds by support for a government vs. opposition party
```{r}
## use margins package to calculate HTS by opposition
m1 <- lm(EBSupport_rec ~ Treatment*opposition, data=df_treatment1)
m2 <- lm(EBVote ~ Treatment*opposition, data=df_treatment1)
m3 <- lm(EBSupport_rec ~ Treatment*opposition, data=df_treatment2)
m4 <- lm(EBVote ~ Treatment*opposition, data=df_treatment2)
m5 <- lm(EBSupport_rec ~ Treatment*opposition, data=df_treatment3)
m6 <- lm(EBVote ~ Treatment*opposition, data=df_treatment3)
m7 <- lm(EBSupport_rec ~ Treatment*opposition, data=df_treatment4)
m8 <- lm(EBVote ~ Treatment*opposition, data=df_treatment4)

ma1 <- margins(m1, variables = "Treatment", at = list(opposition = c("Government party", "Opposition party")))
ame_opposition1 <- as.data.frame(summary(ma1))
ame_opposition1$Treatment <- ame_opposition1$factor
ame_opposition1$upper95 <- ame_opposition1$AME + (ame_opposition1$SE*1.96)
ame_opposition1$lower95 <- ame_opposition1$AME - (ame_opposition1$SE*1.96)
ame_opposition1$Model <- "Support"

ma2 <- margins(m2, variables = "Treatment", at = list(opposition = c("Government party", "Opposition party")))
ame_opposition2 <- as.data.frame(summary(ma2))
ame_opposition2$Treatment <- ame_opposition2$factor
ame_opposition2$upper95 <- ame_opposition2$AME + (ame_opposition2$SE*1.96)
ame_opposition2$lower95 <- ame_opposition2$AME - (ame_opposition2$SE*1.96)
ame_opposition2$Model <- "Vote choice"

ma3 <- margins(m3, variables = "Treatment", at = list(opposition = c("Government party", "Opposition party")))
ame_opposition3 <- as.data.frame(summary(ma3))
ame_opposition3$Treatment <- ame_opposition3$factor
ame_opposition3$upper95 <- ame_opposition3$AME + (ame_opposition3$SE*1.96)
ame_opposition3$lower95 <- ame_opposition3$AME - (ame_opposition3$SE*1.96)
ame_opposition3$Model <- "Support"

ma4 <- margins(m4, variables = "Treatment", at = list(opposition = c("Government party", "Opposition party")))
ame_opposition4 <- as.data.frame(summary(ma4))
ame_opposition4$Treatment <- ame_opposition4$factor
ame_opposition4$upper95 <- ame_opposition4$AME + (ame_opposition4$SE*1.96)
ame_opposition4$lower95 <- ame_opposition4$AME - (ame_opposition4$SE*1.96)
ame_opposition4$Model <- "Vote choice"

ma5 <- margins(m5, variables = "Treatment", at = list(opposition = c("Government party", "Opposition party")))
ame_opposition5 <- as.data.frame(summary(ma5))
ame_opposition5$Treatment <- ame_opposition5$factor
ame_opposition5$upper95 <- ame_opposition5$AME + (ame_opposition5$SE*1.96)
ame_opposition5$lower95 <- ame_opposition5$AME - (ame_opposition5$SE*1.96)
ame_opposition5$Model <- "Support"

ma6 <- margins(m6, variables = "Treatment", at = list(opposition = c("Government party", "Opposition party")))
ame_opposition6 <- as.data.frame(summary(ma6))
ame_opposition6$Treatment <- ame_opposition6$factor
ame_opposition6$upper95 <- ame_opposition6$AME + (ame_opposition6$SE*1.96)
ame_opposition6$lower95 <- ame_opposition6$AME - (ame_opposition6$SE*1.96)
ame_opposition6$Model <- "Vote choice"

ma7 <- margins(m7, variables = "Treatment", at = list(opposition = c("Government party", "Opposition party")))
ame_opposition7 <- as.data.frame(summary(ma7))
ame_opposition7$Treatment <- ame_opposition7$factor
ame_opposition7$upper95 <- ame_opposition7$AME + (ame_opposition7$SE*1.96)
ame_opposition7$lower95 <- ame_opposition7$AME - (ame_opposition7$SE*1.96)
ame_opposition7$Model <- "Support"

ma8 <- margins(m8, variables = "Treatment", at = list(opposition = c("Government party", "Opposition party")))
ame_opposition8 <- as.data.frame(summary(ma8))
ame_opposition8$Treatment <- ame_opposition8$factor
ame_opposition8$upper95 <- ame_opposition8$AME + (ame_opposition8$SE*1.96)
ame_opposition8$lower95 <- ame_opposition8$AME - (ame_opposition8$SE*1.96)
ame_opposition8$Model <- "Vote choice"

ame_opposition <- rbind(ame_opposition1, ame_opposition2, ame_opposition3, ame_opposition4, ame_opposition5, ame_opposition6, ame_opposition7, ame_opposition8)
ame_opposition$Treatment[ame_opposition$Treatment=="TreatmentIn-party: Against"] <- "In-party: Against"
ame_opposition$Treatment[ame_opposition$Treatment=="TreatmentOut-party: Against"] <- "Out-party: Against"
ame_opposition$Treatment[ame_opposition$Treatment=="TreatmentIn-party: In favour"] <- "In-party: In favour"
ame_opposition$Treatment[ame_opposition$Treatment=="TreatmentOut-party: In favour"] <- "Out-party: In favour"

ame_opposition$Treatment <- factor(ame_opposition$Treatment, levels = c("Out-party: In favour", "Out-party: Against", "In-party: Against", "In-party: In favour"))

ame_opposition$Model <- factor(ame_opposition$Model, levels = c("Vote choice", "Support"))

# plot the ates by opposition
figureA20 <- ggplot(ame_opposition, aes(colour = Model)) + 
  geom_errorbar(aes(y = Treatment, xmin=lower95, xmax=upper95), width=0, position=position_dodge(width=0.5)) + 
  geom_point(aes(y = Treatment, x=AME, shape = Model), position = position_dodge(width=0.5), size=2) +
  theme_bw() + facet_wrap(~opposition) + 
  scale_x_continuous(limits=c(-0.3, 0.3),breaks=c(-0.4,-0.2,0,0.2,0.4), labels = c("-0.4", "-0.2", "0", "0.2", "0.4")) +
  geom_vline(xintercept=0, color="grey", linetype = "dashed") + 
      xlab("Average treatment effect") + 
        scale_color_grey(name = "Model", breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +  
      scale_fill_grey(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice"), start = 0.7, end = 0, aesthetics = "colour") +
      scale_shape_discrete(name = "Model",  breaks = c("Support", "Vote choice"), labels = c("Support", "Vote choice")) 
figureA20 
ggsave(figureA20, width = 15, height = 8, units = c("cm"), file ="appendix/figureA20.pdf")
```
